this.BX=this.BX||{};this.BX.UI=this.BX.UI||{};(function(e,t,i,n,r,a){"use strict";var s=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"makeMultipleComparator",value:function e(t){var i=this;var n=Object.keys(t).map((function(e){return"get".concat(r.Text.capitalize(e))}));var a=[];Object.values(t).forEach((function(e){var t=e.toLowerCase().trim();var i=true;var n=true;if(t==="desc"||t==="desc nulls first"){i=false}else if(t==="asc nulls first"){n=false}else if(t==="desc nulls last"){i=false;n=false}a.push({ascOrdering:i,nullsOrdering:n})}));var s=n.length;return function(e,t){var r=0;var l=0;while(l===0&&r<s){var o=n[r];var u=a[r];l=i.compareItemNodes(e,t,o,u.ascOrdering,u.nullsOrdering);r+=1}return l}}},{key:"compareItemNodes",value:function e(t,i,n,a,s){var l=t.getItem();var o=i.getItem();l.getCustomData().get();var u=l[n]();var h=o[n]();var d=0;if(u!==null&&h===null){d=s?-1:1}else if(u===null&&h!==null){d=s?1:-1}else if(u===null&&h===null){d=a?-1:1}else{if(r.Type.isString(u)){d=u.localeCompare(h)}else{d=u-h}}var c=a?1:-1;return d*c}}]);return e}();var l=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"isValid",value:function e(t){return r.Type.isString(t)&&(t===this.HTML||t===this.TEXT)}}]);return e}();babelHelpers.defineProperty(l,"TEXT","text");babelHelpers.defineProperty(l,"HTML","html");var o=function(){function e(t){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"text",null);babelHelpers.defineProperty(this,"type",null);if(r.Type.isPlainObject(t)){if(r.Type.isString(t.text)){this.text=t.text}if(l.isValid(t.type)){this.type=t.type}}else if(r.Type.isString(t)){this.text=t}}babelHelpers.createClass(e,[{key:"getText",value:function e(){return this.text}},{key:"getType",value:function e(){return this.type}},{key:"isNullable",value:function e(){return this.getText()===null}},{key:"renderTo",value:function e(t){var i=this.getText();if(i===null){return}if(this.getType()===null||this.getType()===l.TEXT){t.textContent=i}else if(this.getType()===l.HTML){t.innerHTML=i}}},{key:"toString",value:function e(){var t;return(t=this.getText())!==null&&t!==void 0?t:""}},{key:"toJSON",value:function e(){if(this.getType()===null){return this.getText()}else{return{text:this.getText(),type:this.getType()}}}}]);return e}();var u=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"mark",value:function e(t,i){var n=true;if(t instanceof o){if(t.getType()==="html"){n=false}t=t.getText()}if(!r.Type.isStringFilled(t)||!i||i.count()===0){return t}var a="";var s=0;var l="";i.forEach((function(e){if(s>e.getStartIndex()){return}l=t.substring(s,e.getStartIndex());a+=n?r.Text.encode(l):l;a+='<span class="ui-selector-highlight-mark">';l=t.substring(e.getStartIndex(),e.getEndIndex());a+=n?r.Text.encode(l):l;a+="</span>";s=e.getEndIndex()}));l=t.substring(s);a+=n?r.Text.encode(l):l;return a}}]);return e}();var h=function(){function e(t){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"title",null);babelHelpers.defineProperty(this,"textColor",null);babelHelpers.defineProperty(this,"bgColor",null);babelHelpers.defineProperty(this,"containers",new WeakMap);var i=r.Type.isPlainObject(t)?t:{};this.setTitle(i.title);this.setTextColor(i.textColor);this.setBgColor(i.bgColor)}babelHelpers.createClass(e,[{key:"getTitle",value:function e(){var t=this.getTitleNode();return t!==null&&!t.isNullable()?t.getText():""}},{key:"getTitleNode",value:function e(){return this.title}},{key:"setTitle",value:function e(t){if(r.Type.isStringFilled(t)||r.Type.isPlainObject(t)||t===null){this.title=t===null?null:new o(t)}}},{key:"getTextColor",value:function e(){return this.textColor}},{key:"setTextColor",value:function e(t){if(r.Type.isString(t)||t===null){this.textColor=t}}},{key:"getBgColor",value:function e(){return this.bgColor}},{key:"setBgColor",value:function e(t){if(r.Type.isString(t)||t===null){this.bgColor=t}}},{key:"getContainer",value:function e(t){var i=this.containers.get(t);if(!i){i=document.createElement("span");i.className="ui-selector-item-badge";this.containers.set(t,i)}return i}},{key:"renderTo",value:function e(t){var i=this.getContainer(t);var n=this.getTitleNode();if(n){this.getTitleNode().renderTo(i)}else{i.textContent=""}r.Dom.style(i,"color",this.getTextColor());r.Dom.style(i,"background-color",this.getBgColor());r.Dom.append(i,t)}},{key:"toJSON",value:function e(){return{title:this.getTitleNode(),textColor:this.getTextColor(),bgColor:this.getBgColor()}}}]);return e}();var d=function(){function e(t){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"name",null);babelHelpers.defineProperty(this,"type","string");babelHelpers.defineProperty(this,"searchable",true);babelHelpers.defineProperty(this,"system",false);babelHelpers.defineProperty(this,"sort",null);var i=r.Type.isPlainObject(t)?t:{};if(!r.Type.isStringFilled(i.name)){throw new Error('EntitySelector.SearchField: "name" parameter is required.')}this.name=i.name;this.setType(i.type);this.setSystem(i.system);this.setSort(i.sort);this.setSearchable(i.searchable)}babelHelpers.createClass(e,[{key:"getName",value:function e(){return this.name}},{key:"getType",value:function e(){return this.type}},{key:"setType",value:function e(t){if(r.Type.isStringFilled(t)){this.type=t}}},{key:"getSort",value:function e(){return this.sort}},{key:"setSort",value:function e(t){if(r.Type.isNumber(t)||t===null){this.sort=t}}},{key:"setSearchable",value:function e(t){if(r.Type.isBoolean(t)){this.searchable=t}}},{key:"isSearchable",value:function e(){return this.searchable}},{key:"setSystem",value:function e(t){if(r.Type.isBoolean(t)){this.system=t}}},{key:"isCustom",value:function e(){return!this.isSystem()}},{key:"isSystem",value:function e(){return this.system}}]);return e}();var c=function(){function e(t,i,n){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"field",null);babelHelpers.defineProperty(this,"queryWord",null);babelHelpers.defineProperty(this,"startIndex",null);babelHelpers.defineProperty(this,"endIndex",null);this.field=t;this.queryWord=i;this.startIndex=n;this.endIndex=n+i.length}babelHelpers.createClass(e,[{key:"getField",value:function e(){return this.field}},{key:"getQueryWord",value:function e(){return this.queryWord}},{key:"getStartIndex",value:function e(){return this.startIndex}},{key:"getEndIndex",value:function e(){return this.endIndex}}]);return e}();var g=function e(t,i){if(t.getStartIndex()===i.getStartIndex()){return t.getEndIndex()>i.getEndIndex()?-1:1}else{return t.getStartIndex()>i.getStartIndex()?1:-1}};var f=function(){function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"field",null);babelHelpers.defineProperty(this,"matchIndexes",new i.OrderedArray(g));this.field=t;this.addIndexes(n)}babelHelpers.createClass(e,[{key:"getField",value:function e(){return this.field}},{key:"getMatches",value:function e(){return this.matchIndexes}},{key:"addIndex",value:function e(t){this.matchIndexes.add(t)}},{key:"addIndexes",value:function e(t){var i=this;if(r.Type.isArray(t)){t.forEach((function(e){i.addIndex(e)}))}}}]);return e}();var p=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"handleTransitionEnd",value:function e(t,i){var n=r.Type.isArray(i)?new Set(i):new Set([i]);return new Promise((function(e){var i=function i(a){if(a.target!==t||!n.has(a.propertyName)){return}n["delete"](a.propertyName);if(n.size===0){e(a);r.Event.unbind(t,"transitionend",i)}};r.Event.bind(t,"transitionend",i)}))}},{key:"handleAnimationEnd",value:function e(t,i){return new Promise((function(e){var n=function n(a){if(!i||a.animationName===i){e(a);r.Event.unbind(t,"animationend",n)}};r.Event.bind(t,"animationend",n)}))}}]);return e}();var b=/^data:((?:\w+\/(?:(?!;).)+)?)((?:;[\w\W]*?[^;])*),(.+)$/;var y=function e(t){return typeof t==="string"?t.match(b):false};function v(e){if(y(e)){return e}return encodeURI(e)}function T(e,t){m(e,t);t.add(e)}function m(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function C(e,t,i){k(e,t);return i}function k(e,t){if(e!==t){throw new TypeError("Private static access of wrong provenance")}}function S(e,t,i){if(!t.has(e)){throw new TypeError("attempted to get private field on non-instance")}return i}var H=function e(){babelHelpers.classCallCheck(this,e)};babelHelpers.defineProperty(H,"PARTIAL","partial");babelHelpers.defineProperty(H,"OVERRIDE","override");var x=new WeakSet;var I=new WeakSet;var O=function(){function e(t,n){babelHelpers.classCallCheck(this,e);T(this,I);T(this,x);babelHelpers.defineProperty(this,"item",null);babelHelpers.defineProperty(this,"tab",null);babelHelpers.defineProperty(this,"cache",new r.Cache.MemoryCache);babelHelpers.defineProperty(this,"parentNode",null);babelHelpers.defineProperty(this,"children",null);babelHelpers.defineProperty(this,"childItems",new WeakMap);babelHelpers.defineProperty(this,"loaded",false);babelHelpers.defineProperty(this,"dynamic",false);babelHelpers.defineProperty(this,"dynamicPromise",null);babelHelpers.defineProperty(this,"loader",null);babelHelpers.defineProperty(this,"open",false);babelHelpers.defineProperty(this,"autoOpen",false);babelHelpers.defineProperty(this,"focused",false);babelHelpers.defineProperty(this,"renderMode",H.PARTIAL);babelHelpers.defineProperty(this,"title",null);babelHelpers.defineProperty(this,"subtitle",null);babelHelpers.defineProperty(this,"supertitle",null);babelHelpers.defineProperty(this,"caption",null);babelHelpers.defineProperty(this,"captionOptions",{});babelHelpers.defineProperty(this,"avatar",null);babelHelpers.defineProperty(this,"avatarOptions",null);babelHelpers.defineProperty(this,"link",null);babelHelpers.defineProperty(this,"linkTitle",null);babelHelpers.defineProperty(this,"textColor",null);babelHelpers.defineProperty(this,"badges",null);babelHelpers.defineProperty(this,"badgesOptions",{});babelHelpers.defineProperty(this,"hidden",false);babelHelpers.defineProperty(this,"highlights",[]);babelHelpers.defineProperty(this,"renderWithDebounce",r.Runtime.debounce(this.render,50,this));var a=r.Type.isPlainObject(n)?n:{};if(r.Type.isObject(t)){this.item=t}var l=null;if(r.Type.isFunction(a.itemOrder)){l=a.itemOrder}else if(r.Type.isPlainObject(a.itemOrder)){l=s.makeMultipleComparator(a.itemOrder)}this.children=new i.OrderedArray(l);this.renderMode=a.renderMode===H.OVERRIDE?H.OVERRIDE:H.PARTIAL;if(this.renderMode===H.OVERRIDE){this.setTitle("");this.setSubtitle("");this.setSupertitle("");this.setCaption("");this.setLinkTitle("");this.avatar="";this.avatarOptions={bgSize:null,bgColor:null,bgImage:null,border:null,borderRadius:null};this.textColor="";this.link="";this.badges=[];this.captionOptions={fitContent:null,maxWidth:null};this.badgesOptions={fitContent:null,maxWidth:null}}this.setTitle(a.title);this.setSubtitle(a.subtitle);this.setSupertitle(a.supertitle);this.setCaption(a.caption);this.setCaptionOptions(a.captionOptions);this.setAvatar(a.avatar);this.setAvatarOptions(a.avatarOptions);this.setTextColor(a.textColor);this.setLink(a.link);this.setLinkTitle(a.linkTitle);this.setBadges(a.badges);this.setBadgesOptions(a.badgesOptions);this.setDynamic(a.dynamic);this.setOpen(a.open)}babelHelpers.createClass(e,[{key:"getItem",value:function e(){return this.item}},{key:"isRoot",value:function e(){return this.getParentNode()===null}},{key:"getDialog",value:function e(){return this.getTab().getDialog()}},{key:"setTab",value:function e(t){this.tab=t}},{key:"getTab",value:function e(){return this.tab}},{key:"getParentNode",value:function e(){return this.parentNode}},{key:"setParentNode",value:function e(t){this.parentNode=t}},{key:"getNextSibling",value:function e(){if(!this.getParentNode()){return null}var t=this.getParentNode().getChildren();var i=t.getIndex(this);return t.getByIndex(i+1)}},{key:"getPreviousSibling",value:function e(){if(!this.getParentNode()){return null}var t=this.getParentNode().getChildren();var i=t.getIndex(this);return t.getByIndex(i-1)}},{key:"addChildren",value:function e(t){var i=this;if(!r.Type.isArray(t)){return}t.forEach((function(e){delete e.tabs;var t=i.getDialog().addItem(e);var n=i.addItem(t,e.nodeOptions);n.addChildren(e.children)}))}},{key:"addChild",value:function t(i){if(!(i instanceof e)){throw new Error("EntitySelector.ItemNode: an item must be an instance of EntitySelector.ItemNode.")}if(this.isChildOf(i)||i===this){throw new Error("EntitySelector.ItemNode: a child item cannot be a parent of current item.")}if(this.getChildren().has(i)||this.childItems.has(i.getItem())){return null}this.getChildren().add(i);this.childItems.set(i.getItem(),i);i.setTab(this.getTab());i.setParentNode(this);if(this.isRendered()){this.renderWithDebounce()}return i}},{key:"getDepthLevel",value:function e(){return this.isRoot()?0:this.getParentNode().getDepthLevel()+1}},{key:"addItem",value:function e(t,i){var n=this.childItems.get(t);if(!n){n=t.createNode(i);this.addChild(n)}return n}},{key:"addItems",value:function e(t){var i=this;if(r.Type.isArray(t)){this.disableRender();t.forEach((function(e){if(r.Type.isArray(e)&&e.length===2){i.addItem(e[0],e[1])}else if(e instanceof Ne){i.addItem(e)}}));this.enableRender();if(this.isRendered()){this.renderWithDebounce()}}}},{key:"hasItem",value:function e(t){return this.childItems.has(t)}},{key:"removeChild",value:function e(t){if(!this.getChildren().has(t)){return false}t.removeChildren();if(t.isFocused()){t.unfocus()}t.setParentNode(null);t.getItem().removeNode(t);this.getChildren()["delete"](t);this.childItems["delete"](t.getItem());if(this.isRendered()){r.Dom.remove(t.getOuterContainer())}return true}},{key:"removeChildren",value:function e(){if(!this.hasChildren()){return}this.getChildren().forEach((function(e){e.removeChildren();if(e.isFocused()){e.unfocus()}e.setParentNode(null);e.getItem().removeNode(e)}));this.getChildren().clear();this.childItems=new WeakMap;if(this.isRendered()){if(r.Browser.isIE()){r.Dom.clean(this.getChildrenContainer())}else{this.getChildrenContainer().textContent=""}}}},{key:"hasChild",value:function e(t){return this.getChildren().has(t)}},{key:"isChildOf",value:function e(t){var i=this.getParentNode();while(i!==null){if(i===t){return true}i=i.getParentNode()}return false}},{key:"getFirstChild",value:function e(){return this.children.getFirst()}},{key:"getLastChild",value:function e(){return this.children.getLast()}},{key:"getChildren",value:function e(){return this.children}},{key:"hasChildren",value:function e(){return this.children.count()>0}},{key:"loadChildren",value:function e(){var t=this;if(!this.isDynamic()){throw new Error("EntitySelector.ItemNode.loadChildren: an item node is not dynamic.")}if(this.dynamicPromise){return this.dynamicPromise}this.dynamicPromise=r.ajax.runAction("ui.entityselector.getChildren",{json:{parentItem:this.getItem().getAjaxJson(),dialog:this.getDialog().getAjaxJson()},getParameters:{context:this.getDialog().getContext()}});this.dynamicPromise.then((function(e){if(e&&e.data&&r.Type.isPlainObject(e.data.dialog)){t.addChildren(e.data.dialog.items);t.render()}t.loaded=true}));this.dynamicPromise["catch"]((function(e){t.loaded=false;t.dynamicPromise=null;console.error(e)}));return this.dynamicPromise}},{key:"setOpen",value:function e(t){if(r.Type.isBoolean(t)){if(t&&this.isDynamic()&&!this.isLoaded()){this.setAutoOpen(true)}else{this.open=t}}}},{key:"isOpen",value:function e(){return this.open}},{key:"isAutoOpen",value:function e(){return this.autoOpen&&this.isDynamic()&&!this.isLoaded()}},{key:"setAutoOpen",value:function e(t){if(r.Type.isBoolean(t)){this.autoOpen=t}}},{key:"setDynamic",value:function e(t){if(r.Type.isBoolean(t)){this.dynamic=t}}},{key:"isDynamic",value:function e(){return this.dynamic}},{key:"isLoaded",value:function e(){return this.loaded}},{key:"getLoader",value:function e(){if(this.loader===null){this.loader=new a.Loader({target:this.getIndicatorContainer(),size:30})}return this.loader}},{key:"showLoader",value:function e(){void this.getLoader().show();r.Dom.addClass(this.getIndicatorContainer(),"ui-selector-item-indicator-hidden")}},{key:"hideLoader",value:function e(){void this.getLoader().hide();r.Dom.removeClass(this.getIndicatorContainer(),"ui-selector-item-indicator-hidden")}},{key:"destroyLoader",value:function e(){this.getLoader().destroy();this.loader=null;r.Dom.removeClass(this.getIndicatorContainer(),"ui-selector-item-indicator-hidden")}},{key:"expand",value:function e(){var t=this;if(this.isOpen()||!this.hasChildren()&&!this.isDynamic()){return}if(this.isDynamic()&&!this.isLoaded()){this.loadChildren().then((function(){t.destroyLoader();t.expand()}));this.showLoader();return}r.Dom.addClass(this.getOuterContainer(),"ui-selector-item-box-open");r.Dom.style(this.getChildrenContainer(),"height","0px");r.Dom.style(this.getChildrenContainer(),"opacity",0);requestAnimationFrame((function(){requestAnimationFrame((function(){r.Dom.style(t.getChildrenContainer(),"height","".concat(t.getChildrenContainer().scrollHeight,"px"));r.Dom.style(t.getChildrenContainer(),"opacity",1);p.handleTransitionEnd(t.getChildrenContainer(),"height").then((function(){r.Dom.style(t.getChildrenContainer(),"height",null);r.Dom.style(t.getChildrenContainer(),"opacity",null);r.Dom.addClass(t.getOuterContainer(),"ui-selector-item-box-open");t.setOpen(true)}))}))}))}},{key:"collapse",value:function e(){var t=this;if(!this.isOpen()){return}r.Dom.style(this.getChildrenContainer(),"height","".concat(this.getChildrenContainer().offsetHeight,"px"));requestAnimationFrame((function(){requestAnimationFrame((function(){r.Dom.style(t.getChildrenContainer(),"height","0px");r.Dom.style(t.getChildrenContainer(),"opacity",0);p.handleTransitionEnd(t.getChildrenContainer(),"height").then((function(){r.Dom.style(t.getChildrenContainer(),"height",null);r.Dom.style(t.getChildrenContainer(),"opacity",null);r.Dom.removeClass(t.getOuterContainer(),"ui-selector-item-box-open");t.setOpen(false)}))}))}))}},{key:"render",value:function e(){var t=this;var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(this.isRoot()){this.renderRoot(i);return}var n=this.getTitleNode();if(n){n.renderTo(this.getTitleContainer())}else{this.getTitleContainer().textContent=""}var a=this.getSupertitleNode();if(a){a.renderTo(this.getSupertitleContainer())}else{this.getSupertitleContainer().textContent=""}var s=this.getSubtitleNode();if(s){s.renderTo(this.getSubtitleContainer())}else{this.getSubtitleContainer().textContent=""}var l=this.getCaptionNode();if(l){l.renderTo(this.getCaptionContainer())}else{this.getCaptionContainer().textContent=""}var o=this.getCaptionOption("fitContent");if(r.Type.isBoolean(o)){r.Dom.style(this.getCaptionContainer(),"flex-shrink",o?0:null)}var u=this.getCaptionOption("maxWidth");if(r.Type.isString(u)||r.Type.isNumber(u)){r.Dom.style(this.getCaptionContainer(),"max-width",r.Type.isNumber(u)?"".concat(u,"px"):u)}if(r.Type.isStringFilled(this.getTextColor())){this.getTitleContainer().style.color=this.getTextColor()}else{this.getTitleContainer().style.removeProperty("color")}var h=this.getAvatar();if(r.Type.isStringFilled(h)){this.getAvatarContainer().style.backgroundImage="url('".concat(v(h),"')")}else{var d=this.getAvatarOption("bgImage");if(r.Type.isStringFilled(d)){this.getAvatarContainer().style.backgroundImage=d}else{this.getAvatarContainer().style.removeProperty("background-image")}}var c=this.getAvatarOption("bgColor");if(r.Type.isStringFilled(c)){this.getAvatarContainer().style.backgroundColor=c}else{this.getAvatarContainer().style.removeProperty("background-color")}var g=this.getAvatarOption("bgSize");if(r.Type.isStringFilled(g)){this.getAvatarContainer().style.backgroundSize=g}else{this.getAvatarContainer().style.removeProperty("background-size")}var f=this.getAvatarOption("border");if(r.Type.isStringFilled(f)){this.getAvatarContainer().style.border=f}else{this.getAvatarContainer().style.removeProperty("border")}var p=this.getAvatarOption("borderRadius");if(r.Type.isStringFilled(p)){this.getAvatarContainer().style.borderRadius=p}else{this.getAvatarContainer().style.removeProperty("border-radius")}r.Dom.clean(this.getBadgeContainer());this.getBadges().forEach((function(e){e.renderTo(t.getBadgeContainer())}));var b=this.getBadgesOption("fitContent");if(r.Type.isBoolean(b)){r.Dom.style(this.getBadgeContainer(),"flex-shrink",b?0:null)}var y=this.getBadgesOption("maxWidth");if(r.Type.isString(y)||r.Type.isNumber(y)){r.Dom.style(this.getBadgeContainer(),"max-width",r.Type.isNumber(y)?"".concat(y,"px"):y)}var T=this.getLinkTitleNode();if(T){T.renderTo(this.getLinkTextContainer())}else{this.getLinkTextContainer().textContent=""}if(this.hasChildren()||this.isDynamic()){r.Dom.addClass(this.getOuterContainer(),"ui-selector-item-box-has-children");if(this.getDepthLevel()>=this.getTab().getItemMaxDepth()){r.Dom.addClass(this.getOuterContainer(),"ui-selector-item-box-max-depth")}}else if(this.getOuterContainer().classList.contains("ui-selector-item-box-has-children")){r.Dom.removeClass(this.getOuterContainer(),["ui-selector-item-box-has-children","ui-selector-item-box-max-depth"])}if(this.hasChildren()){var m=this.getChildren().getAll().some((function(e){return e.isHidden()!==true}));if(!m){S(this,x,D).call(this,true)}}this.toggleVisibility();this.highlight();this.renderChildren(i);if(this.isAutoOpen()){this.setAutoOpen(false);requestAnimationFrame((function(){requestAnimationFrame((function(){t.expand()}))}))}this.rendered=true}},{key:"renderRoot",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;this.renderChildren(t);this.rendered=true;var i=this.getTab().getStub();if(i&&i.isAutoShow()&&(this.getDialog().isLoaded()||!this.getDialog().hasDynamicLoad())){if(this.hasChildren()){i.hide()}else{i.show()}}}},{key:"renderChildren",value:function e(){var t=this;var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(!i){if(r.Browser.isIE()){r.Dom.clean(this.getChildrenContainer())}else{this.getChildrenContainer().textContent=""}}if(this.hasChildren()){var n=null;this.getChildren().forEach((function(e){e.render(i);var a=e.getOuterContainer();if(!i){r.Dom.append(a,t.getChildrenContainer())}if(!a.parentNode){if(n!==null){r.Dom.insertAfter(a,n.getOuterContainer())}else{r.Dom.append(a,t.getChildrenContainer())}}n=e}))}}},{key:"isRendered",value:function e(){return this.rendered&&this.getDialog()&&this.getDialog().isRendered()}},{key:"enableRender",value:function e(){this.rendered=true}},{key:"disableRender",value:function e(){this.rendered=false}},{key:"getRenderMode",value:function e(){return this.renderMode}},{key:"isHidden",value:function e(){return this.hidden===true||this.getItem().isHidden()===true}},{key:"setHidden",value:function e(t){if(!r.Type.isBoolean(t)||this.isRoot()){return}S(this,x,D).call(this,t);if(this.isRendered()){this.toggleVisibility();var i=this.getParentNode();var n=this.isHidden();while(i.isRoot()===false){if(n){var a=i.getChildren().getAll().some((function(e){return e.isHidden()!==true}));if(!a){var s;S(s=i,x,D).call(s,true)}i.toggleVisibility()}else{var l;S(l=i,x,D).call(l,false);i.toggleVisibility();if(i.isHidden()){break}}i=i.getParentNode()}}}},{key:"toggleVisibility",value:function e(){if(this.isHidden()){r.Dom.addClass(this.getOuterContainer(),"--hidden")}else if(this.getOuterContainer().classList.contains("--hidden")){r.Dom.removeClass(this.getOuterContainer(),"--hidden")}}},{key:"getTitle",value:function e(){var t=this.getTitleNode();return t!==null?t.getText():null}},{key:"getTitleNode",value:function e(){return this.title!==null?this.title:this.getItem().getTitleNode()}},{key:"setTitle",value:function e(t){if(r.Type.isString(t)||r.Type.isPlainObject(t)){this.title=new o(t)}else if(t===null){this.title=null}}},{key:"getSubtitle",value:function e(){var t=this.getSubtitleNode();return t!==null?t.getText():null}},{key:"getSubtitleNode",value:function e(){return this.subtitle!==null?this.subtitle:this.getItem().getSubtitleNode()}},{key:"setSubtitle",value:function e(t){if(r.Type.isString(t)||r.Type.isPlainObject(t)){this.subtitle=new o(t)}else if(t===null){this.subtitle=null}}},{key:"getSupertitle",value:function e(){var t=this.getSupertitleNode();return t!==null?t.getText():null}},{key:"getSupertitleNode",value:function e(){return this.supertitle!==null?this.supertitle:this.getItem().getSupertitleNode()}},{key:"setSupertitle",value:function e(t){if(r.Type.isString(t)||r.Type.isPlainObject(t)){this.supertitle=new o(t)}else if(t===null){this.supertitle=null}}},{key:"getCaption",value:function e(){var t=this.getCaptionNode();return t!==null?t.getText():null}},{key:"getCaptionNode",value:function e(){return this.caption!==null?this.caption:this.getItem().getCaptionNode()}},{key:"setCaption",value:function e(t){if(r.Type.isString(t)||r.Type.isPlainObject(t)){this.caption=new o(t)}else if(t===null){this.caption=null}}},{key:"getCaptionOption",value:function e(t){if(!r.Type.isUndefined(this.captionOptions[t])){return this.captionOptions[t]}return this.getItem().getCaptionOption(t)}},{key:"setCaptionOption",value:function e(t,i){if(r.Type.isStringFilled(t)&&!r.Type.isUndefined(i)){this.captionOptions[t]=i}}},{key:"setCaptionOptions",value:function e(t){var i=this;if(r.Type.isPlainObject(t)){Object.keys(t).forEach((function(e){i.setCaptionOption(e,t[e])}))}}},{key:"getAvatar",value:function e(){return this.avatar!==null?this.avatar:this.getItem().getAvatar()}},{key:"setAvatar",value:function e(t){if(r.Type.isString(t)||t===null){this.avatar=t}}},{key:"getAvatarOption",value:function e(t){return this.avatarOptions===null||r.Type.isUndefined(this.avatarOptions[t])?this.getItem().getAvatarOption(t):this.avatarOptions[t]}},{key:"setAvatarOption",value:function e(t,i){if(r.Type.isStringFilled(t)&&!r.Type.isUndefined(i)){if(this.avatarOptions===null){this.avatarOptions={}}this.avatarOptions[t]=i}}},{key:"setAvatarOptions",value:function e(t){var i=this;if(r.Type.isPlainObject(t)){Object.keys(t).forEach((function(e){i.setAvatarOption(e,t[e])}))}}},{key:"getTextColor",value:function e(){return this.textColor!==null?this.textColor:this.getItem().getTextColor()}},{key:"setTextColor",value:function e(t){if(r.Type.isString(t)||t===null){this.textColor=t}}},{key:"getLink",value:function e(){return this.link!==null?this.getItem().replaceMacros(this.link):this.getItem().getLink()}},{key:"setLink",value:function e(t){if(r.Type.isString(t)||t===null){this.link=t}}},{key:"getLinkTitle",value:function e(){var t=this.getLinkTitleNode();return t!==null?t.getText():null}},{key:"getLinkTitleNode",value:function e(){return this.linkTitle!==null?this.linkTitle:this.getItem().getLinkTitleNode()}},{key:"setLinkTitle",value:function e(t){if(r.Type.isString(t)||r.Type.isPlainObject(t)){this.linkTitle=new o(t)}else if(t===null){this.linkTitle=null}}},{key:"getBadges",value:function e(){return this.badges!==null?this.badges:this.getItem().getBadges()}},{key:"setBadges",value:function e(t){var i=this;if(r.Type.isArray(t)){this.badges=[];t.forEach((function(e){i.badges.push(new h(e))}))}else if(t===null){this.badges=null}}},{key:"getBadgesOption",value:function e(t){if(!r.Type.isUndefined(this.badgesOptions[t])){return this.badgesOptions[t]}return this.getItem().getBadgesOption(t)}},{key:"setBadgesOption",value:function e(t,i){if(r.Type.isStringFilled(t)&&!r.Type.isUndefined(i)){this.badgesOptions[t]=i}}},{key:"setBadgesOptions",value:function e(t){var i=this;if(r.Type.isPlainObject(t)){Object.keys(t).forEach((function(e){i.setBadgesOption(e,t[e])}))}}},{key:"getOuterContainer",value:function e(){var t=this;return this.cache.remember("outer-container",(function(){var e="";if(t.hasChildren()||t.isDynamic()){e+=" ui-selector-item-box-has-children";if(t.getDepthLevel()>=t.getTab().getItemMaxDepth()){e+=" ui-selector-item-box-max-depth"}}else if(t.getItem().isSelected()){e+=" ui-selector-item-box-selected"}if(t.isOpen()){e+=" ui-selector-item-box-open"}var i=document.createElement("div");i.className="ui-selector-item-box".concat(e);i.appendChild(t.getContainer());i.appendChild(t.getChildrenContainer());return i}))}},{key:"getChildrenContainer",value:function e(){if(this.isRoot()&&this.getTab()){return this.getTab().getItemsContainer()}return this.cache.remember("children-container",(function(){var e=document.createElement("div");e.className="ui-selector-item-children";return e}))}},{key:"getContainer",value:function e(){var t=this;return this.cache.remember("container",(function(){var e=document.createElement("div");e.className="ui-selector-item";r.Event.bind(e,"click",t.handleClick.bind(t));r.Event.bind(e,"mouseenter",t.handleMouseEnter.bind(t));r.Event.bind(e,"mouseleave",t.handleMouseLeave.bind(t));e.appendChild(t.getAvatarContainer());e.appendChild(t.getTitlesContainer());e.appendChild(t.getIndicatorContainer());if(r.Type.isStringFilled(t.getLink())){e.appendChild(t.getLinkContainer())}return e}))}},{key:"getAvatarContainer",value:function e(){return this.cache.remember("avatar",(function(){var e=document.createElement("div");e.className="ui-selector-item-avatar";return e}))}},{key:"getTitlesContainer",value:function e(){var t=this;return this.cache.remember("titles",(function(){var e=document.createElement("div");e.className="ui-selector-item-titles";e.appendChild(t.getSupertitleContainer());e.appendChild(t.getTitleBoxContainer());e.appendChild(t.getSubtitleContainer());return e}))}},{key:"getTitleBoxContainer",value:function e(){var t=this;return this.cache.remember("title-box",(function(){var e=document.createElement("div");e.className="ui-selector-item-title-box";e.appendChild(t.getTitleContainer());e.appendChild(t.getBadgeContainer());e.appendChild(t.getCaptionContainer());return e}))}},{key:"getTitleContainer",value:function e(){return this.cache.remember("title",(function(){var e=document.createElement("div");e.className="ui-selector-item-title";return e}))}},{key:"getSubtitleContainer",value:function e(){return this.cache.remember("subtitle",(function(){var e=document.createElement("div");e.className="ui-selector-item-subtitle";return e}))}},{key:"getSupertitleContainer",value:function e(){return this.cache.remember("supertitle",(function(){var e=document.createElement("div");e.className="ui-selector-item-supertitle";return e}))}},{key:"getCaptionContainer",value:function e(){return this.cache.remember("caption",(function(){var e=document.createElement("div");e.className="ui-selector-item-caption";return e}))}},{key:"getIndicatorContainer",value:function e(){return this.cache.remember("indicator",(function(){var e=document.createElement("div");e.className="ui-selector-item-indicator";return e}))}},{key:"getBadgeContainer",value:function e(){return this.cache.remember("badge",(function(){var e=document.createElement("div");e.className="ui-selector-item-badges";return e}))}},{key:"getLinkContainer",value:function e(){var t=this;return this.cache.remember("link",(function(){var e=document.createElement("a");e.className="ui-selector-item-link";e.href=t.getLink();e.target="_blank";e.title="";r.Event.bind(e,"click",t.handleLinkClick.bind(t));e.appendChild(t.getLinkTextContainer());return e}))}},{key:"getLinkTextContainer",value:function e(){return this.cache.remember("link-text",(function(){var e=document.createElement("span");e.className="ui-selector-item-link-text";return e}))}},{key:"showLink",value:function e(){var t=this;if(r.Type.isStringFilled(this.getLink())){r.Dom.addClass(this.getLinkContainer(),"ui-selector-item-link--show");requestAnimationFrame((function(){requestAnimationFrame((function(){r.Dom.addClass(t.getLinkContainer(),"ui-selector-item-link--animate")}))}))}}},{key:"hideLink",value:function e(){if(r.Type.isStringFilled(this.getLink())){r.Dom.removeClass(this.getLinkContainer(),["ui-selector-item-link--show","ui-selector-item-link--animate"])}}},{key:"setHighlights",value:function e(t){this.highlights=t}},{key:"getHighlights",value:function e(){return this.highlights}},{key:"highlight",value:function e(){var t=this;this.getHighlights().forEach((function(e){var i=e.getField();var n=i.getName();if(i.isCustom()){var r=t.getItem().getCustomData().get(n);t.getSubtitleContainer().innerHTML=u.mark(r,e.getMatches())}else if(i.getName()==="title"){t.getTitleContainer().innerHTML=u.mark(t.getItem().getTitleNode(),e.getMatches())}else if(i.getName()==="subtitle"){t.getSubtitleContainer().innerHTML=u.mark(t.getItem().getSubtitleNode(),e.getMatches())}else if(i.getName()==="supertitle"){t.getSupertitleContainer().innerHTML=u.mark(t.getItem().getSupertitleNode(),e.getMatches())}}))}},{key:"select",value:function e(){if(this.hasChildren()||this.isDynamic()){return}r.Dom.addClass(this.getOuterContainer(),"ui-selector-item-box-selected")}},{key:"deselect",value:function e(){if(this.hasChildren()||this.isDynamic()){return}r.Dom.removeClass(this.getOuterContainer(),"ui-selector-item-box-selected")}},{key:"focus",value:function e(){if(this.isFocused()){return}this.focused=true;r.Dom.addClass(this.getOuterContainer(),"ui-selector-item-box-focused");this.getDialog().emit("ItemNode:onFocus",{node:this})}},{key:"unfocus",value:function e(){if(!this.isFocused()){return}this.focused=false;r.Dom.removeClass(this.getOuterContainer(),"ui-selector-item-box-focused");this.getDialog().emit("ItemNode:onUnfocus",{node:this})}},{key:"isFocused",value:function e(){return this.focused}},{key:"click",value:function e(){if(this.hasChildren()||this.isDynamic()){if(this.isOpen()){this.collapse()}else{this.expand()}}else{if(this.getItem().isSelected()){if(this.getItem().isDeselectable()){this.getItem().deselect()}if(this.getDialog().shouldHideOnDeselect()){this.getDialog().hide()}}else{this.getItem().select();if(this.getDialog().shouldClearSearchOnSelect()){this.getDialog().clearSearch()}if(this.getDialog().shouldHideOnSelect()){this.getDialog().hide()}}}this.getDialog().focusSearch()}},{key:"scrollIntoView",value:function e(){var t=this.getTab().getContainer();var i=this.getContainer();var n=r.Dom.getPosition(t);var a=r.Dom.getPosition(i);var s=9;if(a.top<n.top){t.scrollTop-=n.top-a.top+s}else if(a.bottom>n.bottom){t.scrollTop+=a.bottom-n.bottom+s}}},{key:"handleClick",value:function e(){this.click()}},{key:"handleLinkClick",value:function e(t){this.getDialog().emit("ItemNode:onLinkClick",{node:this,event:t});t.stopPropagation()}},{key:"handleMouseEnter",value:function e(){this.focus();this.showLink();S(this,I,P).call(this)}},{key:"handleMouseLeave",value:function e(){this.unfocus();this.hideLink()}}]);return e}();function D(e){if(r.Type.isBoolean(e)&&!this.isRoot()){this.hidden=e}}function P(){var e=this;var t;if(C(t=this.constructor,O,E).call(t,this.getTitleContainer())){var i;this.getContainer().setAttribute("title",C(i=this.constructor,O,A).call(i,this.getTitleContainer().textContent))}else{r.Dom.attr(this.getContainer(),"title",null)}var n=[this.getSupertitleContainer(),this.getSubtitleContainer(),this.getCaptionContainer()].concat(babelHelpers.toConsumableArray(this.getBadges().map((function(t){return t.getContainer(e.getBadgeContainer())}))));n.forEach((function(t){var i;if(C(i=e.constructor,O,E).call(i,t)){var n;t.setAttribute("title",C(n=e.constructor,O,A).call(n,t.textContent))}else{r.Dom.attr(t,"title",null)}}))}function E(e){return e.offsetWidth<e.scrollWidth}function A(e){return e.replace(/[\t ]+/gm," ").replace(/\n+/gm,"\n").trim()}var w=function(){function e(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"field",null);babelHelpers.defineProperty(this,"indexes",[]);this.field=t;this.addIndexes(i)}babelHelpers.createClass(e,[{key:"getField",value:function e(){return this.field}},{key:"getIndexes",value:function e(){return this.indexes}},{key:"addIndex",value:function e(t){this.getIndexes().push(t)}},{key:"addIndexes",value:function e(t){var i=this;t.forEach((function(e){i.addIndex(e)}))}}]);return e}();var L=function(){function e(t,i){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"word","");babelHelpers.defineProperty(this,"startIndex",0);this.setWord(t);this.setStartIndex(i)}babelHelpers.createClass(e,[{key:"getWord",value:function e(){return this.word}},{key:"setWord",value:function e(t){if(r.Type.isStringFilled(t)){this.word=t}return this}},{key:"getStartIndex",value:function e(){return this.startIndex}},{key:"setStartIndex",value:function e(t){if(r.Type.isNumber(t)&&t>=0){this.startIndex=t}return this}}]);return e}();
/**
	 * @license
	 * Lodash <https://lodash.com/>
	 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
	 * Released under MIT license <https://lodash.com/license>
	 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
	 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
	 */var B="\\ud800-\\udfff";var N="\\u0300-\\u036f";var F="\\ufe20-\\ufe2f";var R="\\u20d0-\\u20ff";var M="\\u1ab0-\\u1aff";var j="\\u1dc0-\\u1dff";var z=N+F+R+M+j;var W="\\u2700-\\u27bf";var U="a-z\\xdf-\\xf6\\xf8-\\xff";var _="\\xac\\xb1\\xd7\\xf7";var V="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";var q="\\u2000-\\u206f";var Q=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000";var X="A-Z\\xc0-\\xd6\\xd8-\\xde";var G="\\ufe0e\\ufe0f";var J=_+V+q+Q;var K="['\u2019]";var Z="[".concat(J,"]");var $="[".concat(z,"]");var Y="\\d";var ee="[".concat(W,"]");var te="[".concat(U,"]");var ie="[^".concat(B).concat(J+Y+W+U+X,"]");var ne="\\ud83c[\\udffb-\\udfff]";var re="(?:".concat($,"|").concat(ne,")");var ae="[^".concat(B,"]");var se="(?:\\ud83c[\\udde6-\\uddff]){2}";var le="[\\ud800-\\udbff][\\udc00-\\udfff]";var oe="[".concat(X,"]");var ue="\\u200d";var he="(?:".concat(te,"|").concat(ie,")");var de="(?:".concat(oe,"|").concat(ie,")");var ce="(?:".concat(K,"(?:d|ll|m|re|s|t|ve))?");var ge="(?:".concat(K,"(?:D|LL|M|RE|S|T|VE))?");var fe="".concat(re,"?");var pe="[".concat(G,"]?");var be="(?:".concat(ue,"(?:").concat([ae,se,le].join("|"),")").concat(pe+fe,")*");var ye="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";var ve="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";var Te=pe+fe+be;var me="(?:".concat([ee,se,le].join("|"),")").concat(Te);var Ce=new RegExp(["".concat(oe,"?").concat(te,"+").concat(ce,"(?=").concat([Z,oe,"$"].join("|"),")"),"".concat(de,"+").concat(ge,"(?=").concat([Z,oe+he,"$"].join("|"),")"),"".concat(oe,"?").concat(he,"+").concat(ce),"".concat(oe,"+").concat(ge),ve,ye,"".concat(Y,"+"),me].join("|"),"g");var ke=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var Se=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var He=/[^\s]+/g;var xe="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}";var Ie=new RegExp("[".concat(xe,"]"));var Oe=function(){function e(){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"indexes",[])}babelHelpers.createClass(e,[{key:"addIndex",value:function e(t){if(r.Type.isObject(t)){this.getIndexes().push(t)}}},{key:"getIndexes",value:function e(){return this.indexes}}],[{key:"create",value:function t(i){var n=this;var a=new e;var s=i.getEntity();if(!i.isSearchable()||!s.isSearchable()||i.isHidden()){return a}var l=s.getSearchFields();l.forEach((function(e){if(!e.isSearchable()){return}if(e.isSystem()){if(e.getName()==="title"){var t=i.getTitleNode();var s=t!==null&&t.getType()==="html";a.addIndex(n.createIndex(e,i.getTitle(),s))}else if(e.getName()==="subtitle"){var l=i.getSubtitleNode();var o=l!==null&&l.getType()==="html";a.addIndex(n.createIndex(e,i.getSubtitle(),o))}else if(e.getName()==="supertitle"){var u=i.getSupertitleNode();var h=u!==null&&u.getType()==="html";a.addIndex(n.createIndex(e,i.getSupertitle(),h))}}else{var d=i.getCustomData().get(e.getName());if(!r.Type.isUndefined(d)){a.addIndex(n.createIndex(e,d))}}}));return a}},{key:"createIndex",value:function e(t,i){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(!r.Type.isStringFilled(i)){return null}if(n){i=i.replace(/<\/?[^>]+>/g,(function(e){return" ".repeat(e.length)}));i=i.replace(/&(?:#\d+|#x[\da-fA-F]+|[0-9a-zA-Z]+);/g,(function(e){return" ".repeat(e.length)}))}var a=null;if(t.getType()==="string"){var s=this.splitText(i);if(r.Type.isArrayFilled(s)){this.fillComplexWords(s);this.fillNonCharWords(s,i);a=new w(t,s)}}else if(t.getType()==="email"){var l=i.indexOf("@");if(l!==-1){a=new w(t,[new L(i.toLowerCase(),0),new L(i.substr(l+1).toLowerCase(),l+1)])}}return a}},{key:"splitText",value:function e(t){if(!r.Type.isStringFilled(t)){return[]}return this.hasUnicodeWord(t)?this.splitUnicodeText(t):this.splitAsciiText(t)}},{key:"splitUnicodeText",value:function e(t){return this.splitTextInternal(t,Ce)}},{key:"splitAsciiText",value:function e(t){return this.splitTextInternal(t,ke)}},{key:"hasUnicodeWord",value:function e(t){return Se.test(t)}},{key:"splitTextInternal",value:function e(t,i){var n;var r=[];i.lastIndex=0;while((n=i.exec(t))!==null){if(n.index===i.lastIndex){i.lastIndex++}r.push(new L(n[0].toLowerCase(),n.index))}return r}},{key:"fillComplexWords",value:function e(t){if(t.length<2){return}var i=null;var n=null;t.forEach((function(e,r){var a=t[r+1];if(a){var s=e.getStartIndex()+e.getWord().length===a.getStartIndex();if(s){if(i===null){i=e.getWord();n=e.getStartIndex()}i+=a.getWord()}else if(i!==null){t.push(new L(i,n));i=null;n=null}}else if(i!==null){t.push(new L(i,n));i=null;n=null}}))}},{key:"fillNonCharWords",value:function e(t,i){if(!Ie.test(i)){return}var n;while((n=He.exec(i))!==null){if(n.index===He.lastIndex){He.lastIndex++}var r=n[0];if(Ie.test(r)){t.push(new L(r.toLowerCase(),n.index));for(var a=0;a<r.length;a++){var s=r[a];if(!xe.includes(s)){break}var l=r.substr(a+1);if(l.length){t.push(new L(l.toLowerCase(),n.index+a+1))}}}}He.lastIndex=0}}]);return e}();var De=function(){function e(t){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"id",null);babelHelpers.defineProperty(this,"options",{});var i=r.Type.isPlainObject(t)?t:{};this.id=i.id;this.options=i.options}babelHelpers.createClass(e,[{key:"getId",value:function e(){return this.id}},{key:"getOptions",value:function e(){return this.options}},{key:"toJSON",value:function e(){return{id:this.getId(),options:this.getOptions()}}}]);return e}();var Pe=function(){function e(t){var n=this;babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"id",null);babelHelpers.defineProperty(this,"options",{});babelHelpers.defineProperty(this,"searchable",true);babelHelpers.defineProperty(this,"searchFields",null);babelHelpers.defineProperty(this,"dynamicLoad",false);babelHelpers.defineProperty(this,"dynamicSearch",false);babelHelpers.defineProperty(this,"searchCacheLimits",[]);babelHelpers.defineProperty(this,"filters",new Map);babelHelpers.defineProperty(this,"itemOptions",{});babelHelpers.defineProperty(this,"tagOptions",{});babelHelpers.defineProperty(this,"badgeOptions",[]);babelHelpers.defineProperty(this,"textNodes",new Map);var a=r.Type.isPlainObject(t)?t:{};if(!r.Type.isStringFilled(a.id)){throw new Error('EntitySelector.Entity: "id" parameter is required.')}var s=this.constructor.getEntityDefaultOptions(a.id)||{};a=r.Runtime.merge(JSON.parse(JSON.stringify(s)),a);this.id=a.id.toLowerCase();this.options=r.Type.isPlainObject(a.options)?a.options:{};this.itemOptions=r.Type.isPlainObject(a.itemOptions)?a.itemOptions:{};this.tagOptions=r.Type.isPlainObject(a.tagOptions)?a.tagOptions:{};this.badgeOptions=r.Type.isArray(a.badgeOptions)?a.badgeOptions:[];if(r.Type.isArray(a.filters)){a.filters.forEach((function(e){n.addFilter(e)}))}this.searchFields=new i.OrderedArray((function(e,t){if(e.getSort()!==null&&t.getSort()===null){return-1}else if(e.getSort()===null&&t.getSort()!==null){return 1}else if(e.getSort()===null&&t.getSort()===null){return-1}else{return e.getSort()-t.getSort()}}));this.setSearchable(a.searchable);this.setDynamicLoad(a.dynamicLoad);this.setDynamicSearch(a.dynamicSearch);this.setSearchFields(a.searchFields);this.setSearchCacheLimits(a.searchCacheLimits)}babelHelpers.createClass(e,[{key:"getId",value:function e(){return this.id}},{key:"getOptions",value:function e(){return this.options}},{key:"getItemOptions",value:function e(){return this.itemOptions}},{key:"getItemOption",value:function e(t,i){return this.constructor.getOptionInternal(this.itemOptions,t,i)}},{key:"getTagOptions",value:function e(){return this.tagOptions}},{key:"getTagOption",value:function e(t,i){return this.constructor.getOptionInternal(this.tagOptions,t,i)}},{key:"getBadges",value:function e(t){var i=this.getItemOption("badges",t.getEntityType())||[];var n=babelHelpers.toConsumableArray(i);this.badgeOptions.forEach((function(e){if(r.Type.isPlainObject(e.conditions)){for(var i in e.conditions){if(t.getCustomData().get(i)!==e.conditions[i]){return}}n.push(e)}}));return n}},{key:"getOptionTextNode",value:function e(t,i){if(!r.Type.isString(t)){return null}if(!r.Type.isString(i)){i="default"}var n=this.textNodes.get(t);var a=n?n.get(i):undefined;if(r.Type.isUndefined(a)){if(!n){n=new Map;this.textNodes.set(t,n)}var s=this.getItemOption(t,i);a=r.Type.isString(s)||r.Type.isPlainObject(s)?new o(s):null;n.set(i,a)}return a}},{key:"isSearchable",value:function e(){return this.searchable}},{key:"setSearchable",value:function e(t){if(r.Type.isBoolean(t)){this.searchable=t}}},{key:"getSearchFields",value:function e(){return this.searchFields}},{key:"setSearchFields",value:function e(t){var i=this;this.searchFields.clear();var n=new d({name:"title",searchable:true,system:true,type:"string"});var a=new d({name:"subtitle",searchable:true,system:true,type:"string"});this.searchFields.add(n);this.searchFields.add(a);var s=r.Type.isArray(t)?t:[];s.forEach((function(e){var t=new d(e);if(t.isSystem()){if(t.getName()==="title"){i.searchFields["delete"](n)}else if(t.getName()==="subtitle"){i.searchFields["delete"](a)}}i.searchFields.add(t)}));this.searchFields.forEach((function(e,t){e.setSort(t)}))}},{key:"setSearchCacheLimits",value:function e(t){var i=this;if(r.Type.isArrayFilled(t)){t.forEach((function(e){if(r.Type.isStringFilled(e)){i.searchCacheLimits.push(new RegExp(e,"i"))}}))}}},{key:"getSearchCacheLimits",value:function e(){return this.searchCacheLimits}},{key:"hasDynamicLoad",value:function e(){return this.dynamicLoad}},{key:"setDynamicLoad",value:function e(t){if(r.Type.isBoolean(t)){this.dynamicLoad=t}}},{key:"hasDynamicSearch",value:function e(){return this.dynamicSearch}},{key:"setDynamicSearch",value:function e(t){if(r.Type.isBoolean(t)){this.dynamicSearch=t}}},{key:"getFilters",value:function e(){return Array.from(this.filters.values())}},{key:"addFilters",value:function e(t){var i=this;if(r.Type.isArray(t)){t.forEach((function(e){i.addFilter(e)}))}}},{key:"addFilter",value:function e(t){if(r.Type.isPlainObject(t)){var i=new De(t);this.filters.set(i.getId(),i)}}},{key:"getFilter",value:function e(t){return this.filters.get(t)||null}},{key:"toJSON",value:function e(){return{id:this.getId(),options:this.getOptions(),searchable:this.isSearchable(),dynamicLoad:this.hasDynamicLoad(),dynamicSearch:this.hasDynamicSearch(),filters:this.getFilters()}}}],[{key:"getDefaultOptions",value:function e(){var t=this;if(this.defaultOptions===null){this.defaultOptions={};this.getExtensions().forEach((function(e){var i=r.Extension.getSettings(e);var n=i.get("entities",[]);n.forEach((function(e){if(r.Type.isStringFilled(e.id)&&r.Type.isPlainObject(e.options)){t.defaultOptions[e.id]=JSON.parse(JSON.stringify(e.options))}}))}))}return this.defaultOptions}},{key:"getExtensions",value:function e(){if(this.extensions===null){var t=r.Extension.getSettings("ui.entity-selector");this.extensions=t.get("extensions",[])}return this.extensions}},{key:"getEntityDefaultOptions",value:function e(t){return this.getDefaultOptions()[t]||null}},{key:"getItemOptions",value:function e(t,i){if(!r.Type.isStringFilled(t)){return null}var n=this.getEntityDefaultOptions(t);var a=n&&n["itemOptions"]?n["itemOptions"]:null;if(r.Type.isUndefined(i)){return a}else{return a&&!r.Type.isUndefined(a[i])?a[i]:null}}},{key:"getTagOptions",value:function e(t,i){if(!r.Type.isStringFilled(t)){return null}var n=this.getEntityDefaultOptions(t);var a=n&&n["tagOptions"]?n["tagOptions"]:null;if(r.Type.isUndefined(i)){return a}else{return a&&!r.Type.isUndefined(a[i])?a[i]:null}}},{key:"getItemOption",value:function e(t,i,n){return this.getOptionInternal(this.getItemOptions(t),i,n)}},{key:"getTagOption",value:function e(t,i,n){return this.getOptionInternal(this.getTagOptions(t),i,n)}},{key:"getOptionInternal",value:function e(t,i,n){if(!r.Type.isPlainObject(t)){return null}if(t[n]&&!r.Type.isUndefined(t[n][i])){return t[n][i]}else if(t["default"]&&!r.Type.isUndefined(t["default"][i])){return t["default"][i]}return null}}]);return e}();babelHelpers.defineProperty(Pe,"extensions",null);babelHelpers.defineProperty(Pe,"defaultOptions",null);var Ee=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"createMapFromOptions",value:function e(t){if(r.Type.isPlainObject(t)){return new Map(Object.entries(t))}var i=new Map;if(r.Type.isArrayFilled(t)){t.forEach((function(e){if(r.Type.isArray(e)&&e.length===2&&r.Type.isString(e[0])){i.set(e[0],e[1])}}))}return i}},{key:"convertMapToObject",value:function e(t){var i={};if(r.Type.isMap(t)){t.forEach((function(e,t){if(r.Type.isString(t)){i[t]=e}}))}return i}}]);return e}();function Ae(e,t){we(e,t);t.add(e)}function we(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function Le(e,t,i){if(!t.has(e)){throw new TypeError("attempted to get private field on non-instance")}return i}var Be=new WeakSet;var Ne=function(){function e(t){babelHelpers.classCallCheck(this,e);Ae(this,Be);babelHelpers.defineProperty(this,"id",null);babelHelpers.defineProperty(this,"entityId",null);babelHelpers.defineProperty(this,"entityType",null);babelHelpers.defineProperty(this,"title",null);babelHelpers.defineProperty(this,"subtitle",null);babelHelpers.defineProperty(this,"supertitle",null);babelHelpers.defineProperty(this,"caption",null);babelHelpers.defineProperty(this,"captionOptions",{});babelHelpers.defineProperty(this,"avatar",null);babelHelpers.defineProperty(this,"avatarOptions",null);babelHelpers.defineProperty(this,"textColor",null);babelHelpers.defineProperty(this,"link",null);babelHelpers.defineProperty(this,"linkTitle",null);babelHelpers.defineProperty(this,"tagOptions",null);babelHelpers.defineProperty(this,"badges",null);babelHelpers.defineProperty(this,"badgesOptions",{});babelHelpers.defineProperty(this,"dialog",null);babelHelpers.defineProperty(this,"nodes",new Set);babelHelpers.defineProperty(this,"selected",false);babelHelpers.defineProperty(this,"searchable",true);babelHelpers.defineProperty(this,"saveable",true);babelHelpers.defineProperty(this,"deselectable",true);babelHelpers.defineProperty(this,"hidden",false);babelHelpers.defineProperty(this,"searchIndex",null);babelHelpers.defineProperty(this,"customData",null);babelHelpers.defineProperty(this,"sort",null);babelHelpers.defineProperty(this,"contextSort",null);babelHelpers.defineProperty(this,"globalSort",null);var i=r.Type.isPlainObject(t)?t:{};if(!r.Type.isStringFilled(i.id)&&!r.Type.isNumber(i.id)){throw new Error('EntitySelector.Item: "id" parameter is required.')}if(!r.Type.isStringFilled(i.entityId)){throw new Error('EntitySelector.Item: "entityId" parameter is required.')}this.id=i.id;this.entityId=i.entityId.toLowerCase();this.entityType=r.Type.isStringFilled(i.entityType)?i.entityType:"default";this.selected=r.Type.isBoolean(i.selected)?i.selected:false;this.customData=Ee.createMapFromOptions(i.customData);this.tagOptions=Ee.createMapFromOptions(i.tagOptions);this.setTitle(i.title);this.setSubtitle(i.subtitle);this.setSupertitle(i.supertitle);this.setCaption(i.caption);this.setCaptionOptions(i.captionOptions);this.setAvatar(i.avatar);this.setAvatarOptions(i.avatarOptions);this.setTextColor(i.textColor);this.setLink(i.link);this.setLinkTitle(i.linkTitle);this.setBadges(i.badges);this.setBadgesOptions(i.badgesOptions);this.setSearchable(i.searchable);this.setSaveable(i.saveable);this.setDeselectable(i.deselectable);this.setHidden(i.hidden);this.setContextSort(i.contextSort);this.setGlobalSort(i.globalSort);this.setSort(i.sort)}babelHelpers.createClass(e,[{key:"getId",value:function e(){return this.id}},{key:"getEntityId",value:function e(){return this.entityId}},{key:"getEntity",value:function e(){var t=this.getDialog().getEntity(this.getEntityId());if(t===null){t=new Pe({id:this.getEntityId()});this.getDialog().addEntity(t)}return t}},{key:"getEntityType",value:function e(){return this.entityType}},{key:"getTitle",value:function e(){var t=this.getTitleNode();return t!==null&&!t.isNullable()?t.getText():""}},{key:"getTitleNode",value:function e(){return this.title}},{key:"setTitle",value:function e(t){if(r.Type.isStringFilled(t)||r.Type.isPlainObject(t)||t===null){this.title=t===null?null:new o(t);this.resetSearchIndex();Le(this,Be,Fe).call(this)}}},{key:"getSubtitle",value:function e(){var t=this.getSubtitleNode();return t!==null?t.getText():null}},{key:"getSubtitleNode",value:function e(){return this.subtitle!==null?this.subtitle:this.getEntityTextNode("subtitle")}},{key:"setSubtitle",value:function e(t){if(r.Type.isString(t)||r.Type.isPlainObject(t)||t===null){this.subtitle=t===null?null:new o(t);this.resetSearchIndex();Le(this,Be,Fe).call(this)}}},{key:"getSupertitle",value:function e(){var t=this.getSupertitleNode();return t!==null?t.getText():null}},{key:"getSupertitleNode",value:function e(){return this.supertitle!==null?this.supertitle:this.getEntityTextNode("supertitle")}},{key:"setSupertitle",value:function e(t){if(r.Type.isString(t)||r.Type.isPlainObject(t)||t===null){this.supertitle=t===null?null:new o(t);this.resetSearchIndex();Le(this,Be,Fe).call(this)}}},{key:"getCaption",value:function e(){var t=this.getCaptionNode();return t!==null?t.getText():null}},{key:"getCaptionNode",value:function e(){return this.caption!==null?this.caption:this.getEntityTextNode("caption")}},{key:"setCaption",value:function e(t){if(r.Type.isString(t)||r.Type.isPlainObject(t)||t===null){this.caption=t===null?null:new o(t);this.resetSearchIndex();Le(this,Be,Fe).call(this)}}},{key:"getCaptionOption",value:function e(t){if(!r.Type.isUndefined(this.captionOptions[t])){return this.captionOptions[t]}var i=this.getEntityItemOption("captionOptions");if(r.Type.isPlainObject(i)&&!r.Type.isUndefined(i[t])){return i[t]}return null}},{key:"setCaptionOption",value:function e(t,i){if(r.Type.isStringFilled(t)&&!r.Type.isUndefined(i)){this.captionOptions[t]=i;Le(this,Be,Fe).call(this)}}},{key:"setCaptionOptions",value:function e(t){var i=this;if(r.Type.isPlainObject(t)){Object.keys(t).forEach((function(e){i.setCaptionOption(e,t[e])}))}}},{key:"getAvatar",value:function e(){return this.avatar!==null?this.avatar:this.getEntityItemOption("avatar")}},{key:"setAvatar",value:function e(t){if(r.Type.isString(t)||t===null){this.avatar=t;Le(this,Be,Fe).call(this)}}},{key:"getAvatarOption",value:function e(t){if(this.avatarOptions!==null&&!r.Type.isUndefined(this.avatarOptions[t])){return this.avatarOptions[t]}var i=this.getEntityItemOption("avatarOptions");if(r.Type.isPlainObject(i)&&!r.Type.isUndefined(i[t])){return i[t]}return null}},{key:"setAvatarOption",value:function e(t,i){if(r.Type.isStringFilled(t)&&!r.Type.isUndefined(i)){if(this.avatarOptions===null){this.avatarOptions={}}this.avatarOptions[t]=i;Le(this,Be,Fe).call(this)}}},{key:"setAvatarOptions",value:function e(t){var i=this;if(r.Type.isPlainObject(t)){Object.keys(t).forEach((function(e){i.setAvatarOption(e,t[e])}))}}},{key:"getTextColor",value:function e(){return this.textColor!==null?this.textColor:this.getEntityItemOption("textColor")}},{key:"setTextColor",value:function e(t){if(r.Type.isString(t)||t===null){this.textColor=t;Le(this,Be,Fe).call(this)}}},{key:"getLink",value:function e(){var t=this.link!==null?this.link:this.getEntityItemOption("link");return this.replaceMacros(t)}},{key:"setLink",value:function e(t){if(r.Type.isString(t)||t===null){this.link=t;Le(this,Be,Fe).call(this)}}},{key:"getLinkTitle",value:function e(){var t=this.getLinkTitleNode();return t!==null?t.getText():r.Loc.getMessage("UI_SELECTOR_ITEM_LINK_TITLE")}},{key:"getLinkTitleNode",value:function e(){return this.linkTitle!==null?this.linkTitle:this.getEntityTextNode("linkTitle")}},{key:"setLinkTitle",value:function e(t){if(r.Type.isString(t)||r.Type.isPlainObject(t)||t===null){this.linkTitle=t===null?null:new o(t);Le(this,Be,Fe).call(this)}}},{key:"getBadges",value:function e(){if(this.badges!==null){return this.badges}var t=this.getEntity().getBadges(this);if(r.Type.isArray(t)){this.setBadges(t)}else{this.badges=[]}return this.badges}},{key:"setBadges",value:function e(t){var i=this;if(r.Type.isArray(t)){this.badges=[];t.forEach((function(e){i.badges.push(new h(e))}));Le(this,Be,Fe).call(this)}else if(t===null){this.badges=null;Le(this,Be,Fe).call(this)}}},{key:"getBadgesOption",value:function e(t){if(!r.Type.isUndefined(this.badgesOptions[t])){return this.badgesOptions[t]}var i=this.getEntityItemOption("badgesOptions");if(r.Type.isPlainObject(i)&&!r.Type.isUndefined(i[t])){return i[t]}return null}},{key:"setBadgesOption",value:function e(t,i){if(r.Type.isStringFilled(t)&&!r.Type.isUndefined(i)){this.badgesOptions[t]=i;Le(this,Be,Fe).call(this)}}},{key:"setBadgesOptions",value:function e(t){var i=this;if(r.Type.isPlainObject(t)){Object.keys(t).forEach((function(e){i.setBadgesOption(e,t[e])}))}}},{key:"setDialog",value:function e(t){this.dialog=t}},{key:"getDialog",value:function e(){return this.dialog}},{key:"createNode",value:function e(t){var i=new O(this,t);this.nodes.add(i);return i}},{key:"removeNode",value:function e(t){this.nodes["delete"](t)}},{key:"getNodes",value:function e(){return this.nodes}},{key:"select",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(this.selected){return}var i=this.getDialog();var r=i&&!t;if(r){var a=new n.BaseEvent({data:{item:this}});i.emit("Item:onBeforeSelect",a);if(a.isDefaultPrevented()){return}}this.selected=true;if(i){i.handleItemSelect(this,!t)}if(this.isRendered()){this.getNodes().forEach((function(e){e.select()}))}if(r){i.emit("Item:onSelect",{item:this});i.saveRecentItem(this)}}},{key:"deselect",value:function e(){if(!this.selected){return}var t=this.getDialog();if(t){var i=new n.BaseEvent({data:{item:this}});t.emit("Item:onBeforeDeselect",i);if(i.isDefaultPrevented()){return}}this.selected=false;if(this.isRendered()){this.getNodes().forEach((function(e){e.deselect()}))}if(t){t.handleItemDeselect(this);t.emit("Item:onDeselect",{item:this})}}},{key:"isSelected",value:function e(){return this.selected}},{key:"setSearchable",value:function e(t){if(r.Type.isBoolean(t)){this.searchable=t}}},{key:"isSearchable",value:function e(){return this.searchable}},{key:"setSaveable",value:function e(t){if(r.Type.isBoolean(t)){this.saveable=t}}},{key:"isSaveable",value:function e(){return this.saveable}},{key:"setDeselectable",value:function e(t){if(r.Type.isBoolean(t)){this.deselectable=t;if(this.getDialog()&&this.getDialog().getTagSelector()){var i=this.getDialog().getTagSelector().getTag({id:this.getId(),entityId:this.getEntityId()});if(i){i.setDeselectable(t)}}}}},{key:"isDeselectable",value:function e(){return this.deselectable}},{key:"setHidden",value:function e(t){if(r.Type.isBoolean(t)){this.hidden=t;if(this.isRendered()){this.getNodes().forEach((function(e){e.setHidden(t)}))}}}},{key:"isHidden",value:function e(){return this.hidden}},{key:"setContextSort",value:function e(t){if(r.Type.isNumber(t)||t===null){this.contextSort=t}}},{key:"getContextSort",value:function e(){return this.contextSort}},{key:"setGlobalSort",value:function e(t){if(r.Type.isNumber(t)||t===null){this.globalSort=t}}},{key:"getGlobalSort",value:function e(){return this.globalSort}},{key:"setSort",value:function e(t){if(r.Type.isNumber(t)||t===null){this.sort=t}}},{key:"getSort",value:function e(){return this.sort}},{key:"getSearchIndex",value:function e(){if(this.searchIndex===null){this.searchIndex=Oe.create(this)}return this.searchIndex}},{key:"resetSearchIndex",value:function e(){this.searchIndex=null}},{key:"getCustomData",value:function e(){return this.customData}},{key:"isRendered",value:function e(){return this.getDialog()&&this.getDialog().isRendered()}},{key:"getEntityItemOption",value:function e(t){return this.getEntity().getItemOption(t,this.getEntityType())}},{key:"getEntityTagOption",value:function e(t){return this.getEntity().getTagOption(t,this.getEntityType())}},{key:"getEntityTextNode",value:function e(t){return this.getEntity().getOptionTextNode(t,this.getEntityType())}},{key:"getTagOptions",value:function e(){return this.tagOptions}},{key:"getTagOption",value:function e(t){var i=this.getTagOptions().get(t);if(!r.Type.isUndefined(i)){return i}return null}},{key:"getTagGlobalOption",value:function e(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(!r.Type.isStringFilled(t)){return null}var n=this.getTagOption(t);if(n===null&&i===true&&this[t]!==null){n=this[t]}if(n===null&&this.getDialog().getTagSelector()){var a="getTag".concat(r.Text.toPascalCase(t));if(r.Type.isFunction(this.getDialog().getTagSelector()[a])){n=this.getDialog().getTagSelector()[a]()}}if(n===null){n=this.getEntityTagOption(t)}if(n===null&&i===true){n=this.getEntityItemOption(t)}return n}},{key:"getTagBgColor",value:function e(){return this.getTagGlobalOption("bgColor")}},{key:"getTagTextColor",value:function e(){return this.getTagGlobalOption("textColor")}},{key:"getTagMaxWidth",value:function e(){return this.getTagGlobalOption("maxWidth")}},{key:"getTagFontWeight",value:function e(){return this.getTagGlobalOption("fontWeight")}},{key:"getTagAvatar",value:function e(){return this.getTagGlobalOption("avatar",true)}},{key:"getTagAvatarOptions",value:function e(){return this.getTagGlobalOption("avatarOptions",true)}},{key:"getTagLink",value:function e(){return this.replaceMacros(this.getTagGlobalOption("link",true))}},{key:"replaceMacros",value:function e(t){if(!r.Type.isStringFilled(t)){return t}return t.replace(/#id#/i,this.getId()).replace(/#element_id#/i,this.getId())}},{key:"createTag",value:function e(){return{id:this.getId(),entityId:this.getEntityId(),entityType:this.getEntityType(),title:this.getTagOption("title")||this.getTitleNode()&&this.getTitleNode().toJSON()||"",deselectable:this.isDeselectable(),avatar:this.getTagAvatar(),avatarOptions:this.getTagAvatarOptions(),link:this.getTagLink(),maxWidth:this.getTagMaxWidth(),textColor:this.getTagTextColor(),bgColor:this.getTagBgColor(),fontWeight:this.getTagFontWeight()}}},{key:"getAjaxJson",value:function e(){return this.toJSON()}},{key:"toJSON",value:function e(){return{id:this.getId(),entityId:this.getEntityId(),entityType:this.getEntityType(),selected:this.isSelected(),deselectable:this.isDeselectable(),searchable:this.isSearchable(),saveable:this.isSaveable(),hidden:this.isHidden(),title:this.getTitleNode(),link:this.getLink(),linkTitle:this.getLinkTitleNode(),subtitle:this.getSubtitleNode(),supertitle:this.getSupertitleNode(),caption:this.getCaptionNode(),avatar:this.getAvatar(),textColor:this.getTextColor(),sort:this.getSort(),contextSort:this.getContextSort(),globalSort:this.getGlobalSort(),customData:Ee.convertMapToObject(this.getCustomData()),tagOptions:Ee.convertMapToObject(this.getTagOptions()),badges:this.getBadges()}}}]);return e}();function Fe(){if(this.isRendered()){this.getNodes().forEach((function(e){e.render()}))}}var Re;var Me=function(){function e(t,i){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"tab",null);babelHelpers.defineProperty(this,"autoShow",true);babelHelpers.defineProperty(this,"cache",new r.Cache.MemoryCache);babelHelpers.defineProperty(this,"content",null);this.options=r.Type.isPlainObject(i)?i:{};this.tab=t;this.autoShow=this.getOption("autoShow",true)}babelHelpers.createClass(e,[{key:"render",value:function e(){throw new Error("You must implement render() method.")}},{key:"getTab",value:function e(){return this.tab}},{key:"getOuterContainer",value:function e(){var t=this;return this.cache.remember("outer-container",(function(){return r.Tag.render(Re||(Re=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-selector-tab-stub">',"</div>\n\t\t\t"])),t.render())}))}},{key:"isAutoShow",value:function e(){return this.autoShow}},{key:"show",value:function e(){r.Dom.append(this.getOuterContainer(),this.getTab().getContainer())}},{key:"hide",value:function e(){r.Dom.remove(this.getOuterContainer())}},{key:"getOptions",value:function e(){return this.options}},{key:"getOption",value:function e(t,i){if(!r.Type.isUndefined(this.options[t])){return this.options[t]}else if(!r.Type.isUndefined(i)){return i}return null}}]);return e}();var je,ze,We,Ue;var _e=function(e){babelHelpers.inherits(t,e);function t(e,i){var n;babelHelpers.classCallCheck(this,t);n=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e,i));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(n),"content",null);return n}babelHelpers.createClass(t,[{key:"getContainer",value:function e(){var t=this;return this.cache.remember("container",(function(){var e=t.getOption("subtitle");var i=r.Type.isStringFilled(t.getOption("title"))?t.getOption("title"):t.getDefaultTitle();var n=t.getOption("icon")||t.getTab().getIcon("default");var a=35;if(r.Type.isNumber(t.getOption("iconOpacity"))){a=Math.min(100,Math.max(0,t.getOption("iconOpacity")))}var s=r.Type.isStringFilled(n)?"style=\"background-image: url('".concat(v(n),"'); opacity: ").concat(a/100,';"'):"";var l=t.getOption("arrow",false)&&t.getTab().getDialog().getActiveFooter()!==null;return r.Tag.render(je||(je=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-selector-tab-default-stub">\n\t\t\t\t\t<div class="ui-selector-tab-default-stub-icon" ','></div>\n\t\t\t\t\t<div class="ui-selector-tab-default-stub-titles">\n\t\t\t\t\t\t<div class="ui-selector-tab-default-stub-title">',"</div>\n\t\t\t\t\t\t","\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t"])),s,i,e?r.Tag.render(ze||(ze=babelHelpers.taggedTemplateLiteral(['<div class="ui-selector-tab-default-stub-subtitle">',"</div>"])),e):"",l?r.Tag.render(We||(We=babelHelpers.taggedTemplateLiteral(['<div class="ui-selector-tab-default-stub-arrow"></div>']))):"")}))}},{key:"getDefaultTitle",value:function e(){var t=this.getTab().getTitleNode();var i=r.Tag.render(Ue||(Ue=babelHelpers.taggedTemplateLiteral(['<span class="ui-selector-tab-default-stub-title"></span>'])));t.renderTo(i);return r.Loc.getMessage("UI_SELECTOR_TAB_STUB_TITLE").replace(/#TAB_TITLE#/,i.innerHTML)}},{key:"render",value:function e(){return this.getContainer()}}]);return t}(Me);var Ve;var qe=function(){function e(t,i){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"dialog",null);babelHelpers.defineProperty(this,"tab",null);babelHelpers.defineProperty(this,"container",null);babelHelpers.defineProperty(this,"cache",new r.Cache.MemoryCache);this.options=r.Type.isPlainObject(i)?i:{};if(t instanceof Gt){this.dialog=t}else{this.tab=t;this.dialog=this.tab.getDialog()}}babelHelpers.createClass(e,[{key:"getDialog",value:function e(){return this.dialog}},{key:"getTab",value:function e(){return this.tab}},{key:"show",value:function e(){r.Dom.addClass(this.getContainer(),"ui-selector-header--show")}},{key:"hide",value:function e(){r.Dom.removeClass(this.getContainer(),"ui-selector-header--show")}},{key:"getOptions",value:function e(){return this.options}},{key:"getOption",value:function e(t,i){if(!r.Type.isUndefined(this.options[t])){return this.options[t]}else if(!r.Type.isUndefined(i)){return i}return null}},{key:"getContainer",value:function e(){if(this.container===null){this.container=r.Tag.render(Ve||(Ve=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-selector-header">',"</div>\n\t\t\t"])),this.render())}return this.container}},{key:"render",value:function e(){throw new Error("You must implement render() method.")}}]);return e}();var Qe;var Xe=function(){function e(t,i){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"dialog",null);babelHelpers.defineProperty(this,"tab",null);babelHelpers.defineProperty(this,"container",null);babelHelpers.defineProperty(this,"cache",new r.Cache.MemoryCache);this.options=r.Type.isPlainObject(i)?i:{};if(t instanceof Gt){this.dialog=t}else{this.tab=t;this.dialog=this.tab.getDialog()}}babelHelpers.createClass(e,[{key:"getDialog",value:function e(){return this.dialog}},{key:"getTab",value:function e(){return this.tab}},{key:"show",value:function e(){r.Dom.addClass(this.getContainer(),"ui-selector-footer--show")}},{key:"hide",value:function e(){r.Dom.removeClass(this.getContainer(),"ui-selector-footer--show")}},{key:"getOptions",value:function e(){return this.options}},{key:"getOption",value:function e(t,i){if(!r.Type.isUndefined(this.options[t])){return this.options[t]}else if(!r.Type.isUndefined(i)){return i}return null}},{key:"getContainer",value:function e(){if(this.container===null){this.container=r.Tag.render(Qe||(Qe=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-selector-footer">',"</div>\n\t\t\t"])),this.render())}return this.container}},{key:"render",value:function e(){throw new Error("You must implement render() method.")}}]);return e}();var Ge,Je,Ke,Ze,$e;var Ye=function(){function e(t,i){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"id",null);babelHelpers.defineProperty(this,"title",null);babelHelpers.defineProperty(this,"rootNode",null);babelHelpers.defineProperty(this,"dialog",null);babelHelpers.defineProperty(this,"stub",null);babelHelpers.defineProperty(this,"visible",true);babelHelpers.defineProperty(this,"rendered",false);babelHelpers.defineProperty(this,"locked",false);babelHelpers.defineProperty(this,"selected",false);babelHelpers.defineProperty(this,"hovered",false);babelHelpers.defineProperty(this,"icon",{});babelHelpers.defineProperty(this,"textColor",{});babelHelpers.defineProperty(this,"bgColor",{});babelHelpers.defineProperty(this,"itemMaxDepth",5);babelHelpers.defineProperty(this,"header",null);babelHelpers.defineProperty(this,"showDefaultHeader",true);babelHelpers.defineProperty(this,"footer",null);babelHelpers.defineProperty(this,"showDefaultFooter",true);babelHelpers.defineProperty(this,"showAvatars",null);babelHelpers.defineProperty(this,"cache",new r.Cache.MemoryCache);var n=r.Type.isPlainObject(i)?i:{};if(!r.Type.isStringFilled(n.id)){throw new Error('EntitySelector.Tab: "id" parameter is required.')}this.setDialog(t);this.id=n.id;this.showDefaultHeader=n.showDefaultHeader!==false;this.showDefaultFooter=n.showDefaultFooter!==false;this.rootNode=new O(null,{itemOrder:n.itemOrder});this.rootNode.setTab(this);this.setVisible(n.visible);this.setTitle(n.title);this.setItemMaxDepth(n.itemMaxDepth);this.setIcon(n.icon);this.setTextColor(n.textColor);this.setBgColor(n.bgColor);this.setStub(n.stub,n.stubOptions);this.setHeader(n.header,n.headerOptions);this.setFooter(n.footer,n.footerOptions);this.setShowAvatars(n.showAvatars)}babelHelpers.createClass(e,[{key:"getId",value:function e(){return this.id}},{key:"setDialog",value:function e(t){this.dialog=t}},{key:"getDialog",value:function e(){return this.dialog}},{key:"getStub",value:function e(){return this.stub}},{key:"setStub",value:function e(t,i){var n=null;var a=r.Type.isPlainObject(i)?i:{};if(r.Type.isString(t)||r.Type.isFunction(t)){var s=r.Type.isString(t)?r.Reflection.getClass(t):t;if(r.Type.isFunction(s)){n=new s(this,a);if(!(n instanceof Me)){console.error("EntitySelector: stub is not an instance of BaseStub.");n=null}}}if(!n&&t!==false){n=new _e(this,a)}this.stub=n}},{key:"getHeader",value:function e(){return this.header}},{key:"setHeader",value:function e(t,i){var n=null;if(t!==null){n=Gt.createHeader(this,t,i);if(n===null){return}}if(this.isRendered()&&this.getHeader()!==null){r.Dom.remove(this.getHeader().getContainer());this.getDialog().adjustHeader()}this.header=n;if(this.isRendered()){this.getDialog().appendHeader(n);this.getDialog().adjustHeader()}}},{key:"canShowDefaultHeader",value:function e(){return this.showDefaultHeader}},{key:"enableDefaultHeader",value:function e(){this.showDefaultHeader=true;this.getDialog().adjustHeader()}},{key:"disableDefaultHeader",value:function e(){this.showDefaultHeader=false;this.getDialog().adjustHeader()}},{key:"getFooter",value:function e(){return this.footer}},{key:"setFooter",value:function e(t,i){var n=null;if(t!==null){n=Gt.createFooter(this,t,i);if(n===null){return}}if(this.isRendered()&&this.getFooter()!==null){r.Dom.remove(this.getFooter().getContainer());this.getDialog().adjustFooter()}this.footer=n;if(this.isRendered()){this.getDialog().appendFooter(n);this.getDialog().adjustFooter()}}},{key:"canShowDefaultFooter",value:function e(){return this.showDefaultFooter}},{key:"enableDefaultFooter",value:function e(){this.showDefaultFooter=true;this.getDialog().adjustFooter()}},{key:"disableDefaultFooter",value:function e(){this.showDefaultFooter=false;this.getDialog().adjustFooter()}},{key:"setShowAvatars",value:function e(t){if(r.Type.isBoolean(t)||t===null){this.showAvatars=t;if(this.isRendered()){this.renderContainer()}}}},{key:"shouldShowAvatars",value:function e(){var t;return(t=this.showAvatars)!==null&&t!==void 0?t:this.getDialog().shouldShowAvatars()}},{key:"getRootNode",value:function e(){return this.rootNode}},{key:"setTitle",value:function e(t){if(r.Type.isStringFilled(t)||r.Type.isPlainObject(t)||t===null){this.title=t===null?null:new o(t);if(this.isRendered()){this.renderLabel()}}}},{key:"getTitle",value:function e(){var t=this.getTitleNode();return t!==null&&!t.isNullable()?t.getText():""}},{key:"getTitleNode",value:function e(){return this.title}},{key:"setIcon",value:function e(t){return this.setProperty("icon",t)}},{key:"getIcon",value:function e(t){return this.getPropertyByState("icon",t)}},{key:"setBgColor",value:function e(t){return this.setProperty("bgColor",t)}},{key:"getBgColor",value:function e(t){return this.getPropertyByState("bgColor",t)}},{key:"setTextColor",value:function e(t){return this.setProperty("textColor",t)}},{key:"getTextColor",value:function e(t){return this.getPropertyByState("textColor",t)}},{key:"setProperty",value:function e(t,i){var n=this[t];if(!n){return}if(r.Type.isPlainObject(i)){Object.keys(i).forEach((function(e){if(r.Type.isStringFilled(i[e])){n[e]=i[e]}}))}else if(r.Type.isStringFilled(i)){n["default"]=i}}},{key:"getPropertyByState",value:function e(t,i){var n=this[t];var a=r.Type.isStringFilled(i)?i:"default";if(!r.Type.isUndefined(n)&&!r.Type.isUndefined(n[a])){return n[a]}return null}},{key:"getPropertyByCurrentState",value:function e(t){var i=this[t];if(this.isSelected()&&this.isHovered()&&i.selectedHovered){return i.selectedHovered}else if(this.isSelected()&&i.selected){return i.selected}else if(this.isHovered()&&i.hovered){return i.hovered}else if(i["default"]){return i["default"]}return null}},{key:"setItemMaxDepth",value:function e(t){if(r.Type.isNumber(t)&&t>0){this.itemMaxDepth=t}}},{key:"getItemMaxDepth",value:function e(){return this.itemMaxDepth}},{key:"getContainer",value:function e(){var t=this;return this.cache.remember("container",(function(){return r.Tag.render(Ge||(Ge=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-selector-tab-content">',"</div>\n\t\t\t"])),t.getItemsContainer())}))}},{key:"getLabelContainer",value:function e(){var t=this;return this.cache.remember("label",(function(){var e=t.isVisible()?"":" ui-selector-tab-label-hidden";return r.Tag.render(Je||(Je=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div \n\t\t\t\t\tclass="ui-selector-tab-label','" \n\t\t\t\t\tonclick="','"\n\t\t\t\t\tonmouseenter="','"\n\t\t\t\t\tonmouseleave="','"\n\t\t\t\t>\n\t\t\t\t\t',"\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t"])),e,t.handleLabelClick.bind(t),t.handleLabelMouseEnter.bind(t),t.handleLabelMouseLeave.bind(t),t.getIconContainer(),t.getTitleContainer())}))}},{key:"getIconContainer",value:function e(){return this.cache.remember("icon",(function(){return r.Tag.render(Ke||(Ke=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-selector-tab-icon"></div>\n\t\t\t'])))}))}},{key:"getTitleContainer",value:function e(){return this.cache.remember("title",(function(){return r.Tag.render(Ze||(Ze=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-selector-tab-title"></div>\n\t\t\t'])))}))}},{key:"getItemsContainer",value:function e(){return this.cache.remember("items",(function(){return r.Tag.render($e||($e=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-selector-items"></div>\n\t\t\t'])))}))}},{key:"render",value:function e(){this.getRootNode().render();this.rendered=true}},{key:"renderLabel",value:function e(){r.Dom.style(this.getTitleContainer(),"color",this.getPropertyByCurrentState("textColor"));r.Dom.style(this.getLabelContainer(),"background-color",this.getPropertyByCurrentState("bgColor"));var t=this.getPropertyByCurrentState("icon");r.Dom.style(this.getIconContainer(),"background-image",t?"url('".concat(v(t),"')"):null);var i=this.getTitleNode();if(i){this.getTitleNode().renderTo(this.getTitleContainer())}else{this.getTitleContainer().textContent=""}}},{key:"renderContainer",value:function e(){var t="ui-selector-tab-content--hide-avatars";if(this.shouldShowAvatars()){r.Dom.removeClass(this.getContainer(),t)}else{r.Dom.addClass(this.getContainer(),t)}}},{key:"isVisible",value:function e(){return this.visible}},{key:"setVisible",value:function e(t){if(r.Type.isBoolean(t)){this.visible=t;if(this.isRendered()){if(this.visible){r.Dom.remove(this.getLabelContainer(),"ui-selector-tab-label-hidden")}else{r.Dom.addClass(this.getLabelContainer(),"ui-selector-tab-label-hidden")}}}}},{key:"isRendered",value:function e(){return this.rendered&&this.getDialog()&&this.getDialog().isRendered()}},{key:"select",value:function e(){if(this.isSelected()){return}r.Dom.addClass(this.getContainer(),"ui-selector-tab-content-active");if(this.isVisible()){r.Dom.addClass(this.getLabelContainer(),"ui-selector-tab-label-active");this.renderLabel()}this.selected=true;if(this.isVisible()){this.renderLabel()}if(this.getHeader()){this.getHeader().show()}if(this.getFooter()){this.getFooter().show()}this.getDialog().emit("Tab:onSelect",{tab:this})}},{key:"deselect",value:function e(){if(!this.isSelected()){return}r.Dom.removeClass(this.getContainer(),"ui-selector-tab-content-active");if(this.isVisible()){r.Dom.removeClass(this.getLabelContainer(),"ui-selector-tab-label-active")}this.selected=false;if(this.isVisible()){this.renderLabel()}if(this.getHeader()){this.getHeader().hide()}if(this.getFooter()){this.getFooter().hide()}this.getDialog().emit("Tab:onDeselect",{tab:this})}},{key:"hover",value:function e(){if(this.isHovered()){return}r.Dom.addClass(this.getLabelContainer(),"ui-selector-tab-label-hover");this.hovered=true;this.renderLabel()}},{key:"unhover",value:function e(){if(!this.isHovered()){return}r.Dom.removeClass(this.getLabelContainer(),"ui-selector-tab-label-hover");this.hovered=false;this.renderLabel()}},{key:"isSelected",value:function e(){return this.selected}},{key:"isHovered",value:function e(){return this.hovered}},{key:"lock",value:function e(){this.locked=true;r.Dom.addClass(this.getContainer(),"ui-selector-tab-content-locked")}},{key:"unlock",value:function e(){this.locked=false;r.Dom.removeClass(this.getContainer(),"ui-selector-tab-content-locked")}},{key:"isLocked",value:function e(){return this.locked}},{key:"handleLabelClick",value:function e(){this.getDialog().selectTab(this.getId())}},{key:"handleLabelMouseEnter",value:function e(){this.hover()}},{key:"handleLabelMouseLeave",value:function e(){this.unhover()}}]);return e}();var et,tt,it,nt,rt,at;var st=function(){function e(t){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"id",null);babelHelpers.defineProperty(this,"entityId",null);babelHelpers.defineProperty(this,"entityType",null);babelHelpers.defineProperty(this,"title",null);babelHelpers.defineProperty(this,"avatar",null);babelHelpers.defineProperty(this,"avatarOptions",null);babelHelpers.defineProperty(this,"maxWidth",null);babelHelpers.defineProperty(this,"textColor",null);babelHelpers.defineProperty(this,"bgColor",null);babelHelpers.defineProperty(this,"fontWeight",null);babelHelpers.defineProperty(this,"link",null);babelHelpers.defineProperty(this,"onclick",null);babelHelpers.defineProperty(this,"deselectable",null);babelHelpers.defineProperty(this,"customData",null);babelHelpers.defineProperty(this,"cache",new r.Cache.MemoryCache);babelHelpers.defineProperty(this,"selector",null);babelHelpers.defineProperty(this,"rendered",false);var i=r.Type.isPlainObject(t)?t:{};if(!r.Type.isStringFilled(i.id)&&!r.Type.isNumber(i.id)){throw new Error('TagSelector.TagItem: "id" parameter is required.')}if(!r.Type.isStringFilled(i.entityId)){throw new Error('TagSelector.TagItem: "entityId" parameter is required.')}this.id=i.id;this.entityId=i.entityId.toLowerCase();this.entityType=r.Type.isStringFilled(i.entityType)?i.entityType:"default";this.customData=Ee.createMapFromOptions(i.customData);this.onclick=r.Type.isFunction(i.onclick)?i.onclick:null;this.link=r.Type.isStringFilled(i.link)?i.link:null;this.setTitle(i.title);this.setDeselectable(i.deselectable);this.setAvatar(i.avatar);this.setAvatarOptions(i.avatarOptions);this.setMaxWidth(i.maxWidth);this.setTextColor(i.textColor);this.setBgColor(i.bgColor);this.setFontWeight(i.fontWeight)}babelHelpers.createClass(e,[{key:"getId",value:function e(){return this.id}},{key:"getEntityId",value:function e(){return this.entityId}},{key:"getEntityType",value:function e(){return this.entityType}},{key:"getSelector",value:function e(){return this.selector}},{key:"setSelector",value:function e(t){this.selector=t}},{key:"getTitle",value:function e(){return this.getTitleNode()&&!this.getTitleNode().isNullable()?this.getTitleNode().getText():""}},{key:"getTitleNode",value:function e(){return this.title}},{key:"setTitle",value:function e(t){if(r.Type.isStringFilled(t)||r.Type.isPlainObject(t)||t===null){this.title=t===null?null:new o(t)}}},{key:"getAvatar",value:function e(){if(this.avatar!==null){return this.avatar}else if(this.getSelector().getTagAvatar()!==null){return this.getSelector().getTagAvatar()}else if(this.getEntityTagOption("avatar")!==null){return this.getEntityTagOption("avatar")}return this.getEntityItemOption("avatar")}},{key:"setAvatar",value:function e(t){if(r.Type.isString(t)||t===null){this.avatar=t}}},{key:"getAvatarOption",value:function e(t){if(this.avatarOptions!==null&&!r.Type.isUndefined(this.avatarOptions[t])){return this.avatarOptions[t]}var i=this.getSelector().getTagAvatarOption(t);if(i!==null){return i[t]}var n=this.getEntityTagOption("avatarOptions");if(r.Type.isPlainObject(n)&&!r.Type.isUndefined(n[t])){return n[t]}var a=this.getEntityItemOption("avatarOptions");if(r.Type.isPlainObject(a)&&!r.Type.isUndefined(a[t])){return a[t]}return null}},{key:"setAvatarOption",value:function e(t,i){if(r.Type.isStringFilled(t)&&!r.Type.isUndefined(i)){if(this.avatarOptions===null){this.avatarOptions={}}this.avatarOptions[t]=i}}},{key:"setAvatarOptions",value:function e(t){var i=this;if(r.Type.isPlainObject(t)){Object.keys(t).forEach((function(e){i.setAvatarOption(e,t[e])}))}}},{key:"getTextColor",value:function e(){if(this.textColor!==null){return this.textColor}else if(this.getSelector().getTagTextColor()!==null){return this.getSelector().getTagTextColor()}return this.getEntityTagOption("textColor")}},{key:"setTextColor",value:function e(t){if(r.Type.isString(t)||t===null){this.textColor=t}}},{key:"getBgColor",value:function e(){if(this.bgColor!==null){return this.bgColor}else if(this.getSelector().getTagBgColor()!==null){return this.getSelector().getTagBgColor()}return this.getEntityTagOption("bgColor")}},{key:"setBgColor",value:function e(t){if(r.Type.isString(t)||t===null){this.bgColor=t}}},{key:"getFontWeight",value:function e(){if(this.fontWeight!==null){return this.fontWeight}else if(this.getSelector().getTagFontWeight()!==null){return this.getSelector().getTagFontWeight()}return this.getEntityTagOption("fontWeight")}},{key:"setFontWeight",value:function e(t){if(r.Type.isString(t)||t===null){this.fontWeight=t}}},{key:"getMaxWidth",value:function e(){if(this.maxWidth!==null){return this.maxWidth}else if(this.getSelector().getTagMaxWidth()!==null){return this.getSelector().getTagMaxWidth()}return this.getEntityTagOption("maxWidth")}},{key:"setMaxWidth",value:function e(t){if(r.Type.isNumber(t)&&t>=0||t===null){this.maxWidth=t}}},{key:"setDeselectable",value:function e(t){if(r.Type.isBoolean(t)){this.deselectable=t}}},{key:"isDeselectable",value:function e(){return this.deselectable!==null?this.deselectable:this.getSelector().isDeselectable()}},{key:"getCustomData",value:function e(){return this.customData}},{key:"getLink",value:function e(){return this.link}},{key:"getOnclick",value:function e(){return this.onclick}},{key:"render",value:function e(){var t=this.getTitleNode();if(t){t.renderTo(this.getTitleContainer())}else{this.getTitleContainer().textContent="";r.Dom.attr(this.getContentContainer(),"title","")}var i=this.getAvatar();var n=this.getAvatarOption("bgImage");if(r.Type.isStringFilled(i)){r.Dom.style(this.getAvatarContainer(),"background-image","url('".concat(v(i),"')"))}else{r.Dom.style(this.getAvatarContainer(),"background-image",n)}var a=this.getAvatarOption("bgColor");var s=this.getAvatarOption("bgSize");var l=this.getAvatarOption("border");var o=this.getAvatarOption("borderRadius");r.Dom.style(this.getAvatarContainer(),"background-color",a);r.Dom.style(this.getAvatarContainer(),"background-size",s);r.Dom.style(this.getAvatarContainer(),"border",l);r.Dom.style(this.getAvatarContainer(),"border-radius",o);var u=i||a&&a!=="none"||n&&n!=="none";if(u){r.Dom.addClass(this.getContainer(),"ui-tag-selector-tag--has-avatar")}else{r.Dom.removeClass(this.getContainer(),"ui-tag-selector-tag--has-avatar")}var h=this.getMaxWidth();if(h>0){r.Dom.style(this.getContainer(),"max-width","".concat(h,"px"))}else{r.Dom.style(this.getContainer(),"max-width",null)}if(this.isDeselectable()){r.Dom.removeClass(this.getContainer(),"ui-tag-selector-tag-readonly")}else{r.Dom.addClass(this.getContainer(),"ui-tag-selector-tag-readonly")}r.Dom.style(this.getTitleContainer(),"color",this.getTextColor());r.Dom.style(this.getTitleContainer(),"font-weight",this.getFontWeight());r.Dom.style(this.getContainer(),"background-color",this.getBgColor());this.rendered=true}},{key:"getContainer",value:function e(){var t=this;return this.cache.remember("container",(function(){return r.Tag.render(et||(et=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-tag-selector-item ui-tag-selector-tag">\n\t\t\t\t\t',"\n\t\t\t\t\t","\n\t\t\t\t</div>"])),t.getContentContainer(),t.getRemoveIcon())}))}},{key:"getContentContainer",value:function e(){var t=this;return this.cache.remember("content-container",(function(){if(r.Type.isStringFilled(t.getLink())){return r.Tag.render(tt||(tt=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t<a\n\t\t\t\t\t\tclass="ui-tag-selector-tag-content"\n\t\t\t\t\t\tonclick="','"\n\t\t\t\t\t\thref="','"\n\t\t\t\t\t\ttarget="_blank"\n\t\t\t\t\t>\n\t\t\t\t\t\t',"\n\t\t\t\t\t\t","\n\t\t\t\t\t</a>\n\t\t\t\t"])),t.handleContainerClick.bind(t),t.getLink(),t.getAvatarContainer(),t.getTitleContainer())}else{var e=r.Type.isFunction(t.getOnclick())?" ui-tag-selector-tag-content--clickable":"";return r.Tag.render(it||(it=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t<div \n\t\t\t\t\t\tclass="ui-tag-selector-tag-content','" \n\t\t\t\t\t\tonclick="','"\n\t\t\t\t\t>\n\t\t\t\t\t\t',"\n\t\t\t\t\t\t","\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t"])),e,t.handleContainerClick.bind(t),t.getAvatarContainer(),t.getTitleContainer())}}))}},{key:"getAvatarContainer",value:function e(){return this.cache.remember("avatar",(function(){return r.Tag.render(nt||(nt=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-tag-selector-tag-avatar"></div>\n\t\t\t'])))}))}},{key:"getTitleContainer",value:function e(){return this.cache.remember("title",(function(){return r.Tag.render(rt||(rt=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-tag-selector-tag-title"></div>\n\t\t\t'])))}))}},{key:"getRemoveIcon",value:function e(){var t=this;return this.cache.remember("remove-icon",(function(){return r.Tag.render(at||(at=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-tag-selector-tag-remove" onclick="','"></div>\n\t\t\t'])),t.handleRemoveIconClick.bind(t))}))}},{key:"getEntityTagOption",value:function e(t){return Pe.getTagOption(this.getEntityId(),t,this.getEntityType())}},{key:"getEntityItemOption",value:function e(t){return Pe.getItemOption(this.getEntityId(),t,this.getEntityType())}},{key:"isRendered",value:function e(){return this.rendered&&this.getSelector()&&this.getSelector().isRendered()}},{key:"remove",value:function e(){var t=this;var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(i===false){r.Dom.remove(this.getContainer());return Promise.resolve()}return new Promise((function(e){r.Dom.style(t.getContainer(),"width","".concat(t.getContainer().offsetWidth,"px"));r.Dom.addClass(t.getContainer(),"ui-tag-selector-tag--remove");p.handleAnimationEnd(t.getContainer(),"ui-tag-selector-tag-remove").then((function(){r.Dom.remove(t.getContainer());e()}))}))}},{key:"show",value:function e(){var t=this;return new Promise((function(e){r.Dom.addClass(t.getContainer(),"ui-tag-selector-tag--show");p.handleAnimationEnd(t.getContainer(),"ui-tag-selector-tag-show").then((function(){r.Dom.removeClass(t.getContainer(),"ui-tag-selector-tag--show");e()}))}))}},{key:"handleContainerClick",value:function e(){var t=this.getOnclick();if(r.Type.isFunction(t)){t(this)}}},{key:"handleRemoveIconClick",value:function e(t){t.stopPropagation();if(this.isDeselectable()){this.getSelector().removeTag(this)}}}]);return e}();var lt,ot,ut,ht,dt,ct,gt;var ft=function(e){babelHelpers.inherits(t,e);function t(e){var i;babelHelpers.classCallCheck(this,t);i=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"tags",[]);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"cache",new r.Cache.MemoryCache);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"multiple",true);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"readonly",false);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"locked",false);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"deselectable",true);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"addButtonCaption",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"addButtonCaptionMore",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"createButtonCaption",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"addButtonVisible",true);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"createButtonVisible",false);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"textBoxVisible",false);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"textBoxWidth",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"maxHeight",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"placeholder","");babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"textBoxAutoHide",false);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"textBoxOldValue","");babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"tagAvatar",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"tagAvatarOptions",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"tagTextColor",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"tagBgColor",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"tagFontWeight",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"tagMaxWidth",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"dialog",null);i.setEventNamespace("BX.UI.EntitySelector.TagSelector");var n=r.Type.isPlainObject(e)?e:{};i.id=r.Type.isStringFilled(n.id)?n.id:"ui-tag-selector-".concat(r.Text.getRandom().toLowerCase());i.multiple=r.Type.isBoolean(n.multiple)?n.multiple:true;i.addButtonVisible=n.showAddButton!==false;i.createButtonVisible=n.showCreateButton===true;i.textBoxVisible=n.showTextBox===true;i.setReadonly(n.readonly);i.setLocked(n.locked);i.setAddButtonCaption(n.addButtonCaption);i.setAddButtonCaptionMore(n.addButtonCaptionMore);i.setCreateButtonCaption(n.createButtonCaption);i.setPlaceholder(n.placeholder);i.setTextBoxAutoHide(n.textBoxAutoHide);i.setTextBoxWidth(n.textBoxWidth);i.setDeselectable(n.deselectable);i.setMaxHeight(n.maxHeight);i.setTagAvatar(n.tagAvatar);i.setTagAvatarOptions(n.tagAvatarOptions);i.setTagMaxWidth(n.tagMaxWidth);i.setTagTextColor(n.tagTextColor);i.setTagBgColor(n.tagBgColor);i.setTagFontWeight(n.tagFontWeight);if(r.Type.isPlainObject(n.dialogOptions)){var a=r.Type.isArray(n.items)?n.items:[];if(r.Type.isArray(n.dialogOptions.selectedItems)){a=a.concat(n.dialogOptions.selectedItems)}var s=Object.assign({},n.dialogOptions,{tagSelectorOptions:null,selectedItems:a,multiple:i.isMultiple(),tagSelector:babelHelpers.assertThisInitialized(i)});new Gt(s)}else if(r.Type.isArray(n.items)){n.items.forEach((function(e){i.addTag(e)}))}i.subscribeFromOptions(n.events);return i}babelHelpers.createClass(t,[{key:"getDialog",value:function e(){return this.dialog}},{key:"setDialog",value:function e(t){this.dialog=t}},{key:"setReadonly",value:function e(t){if(r.Type.isBoolean(t)){this.readonly=t;if(this.isRendered()){if(t){r.Dom.addClass(this.getOuterContainer(),"ui-tag-selector-container-readonly")}else{r.Dom.removeClass(this.getOuterContainer(),"ui-tag-selector-container-readonly")}}}}},{key:"isReadonly",value:function e(){return this.readonly}},{key:"setLocked",value:function e(t){if(r.Type.isBoolean(t)){this.locked=t;if(t){r.Dom.addClass(this.getOuterContainer(),"ui-tag-selector-container-locked");this.getTextBox().disabled=true}else{r.Dom.removeClass(this.getOuterContainer(),"ui-tag-selector-container-locked");this.getTextBox().disabled=false}}}},{key:"lock",value:function e(){if(!this.isLocked()){this.setLocked(true)}}},{key:"unlock",value:function e(){if(this.isLocked()){this.setLocked(false)}}},{key:"isLocked",value:function e(){return this.locked}},{key:"isMultiple",value:function e(){return this.multiple}},{key:"setDeselectable",value:function e(t){if(r.Type.isBoolean(t)){var i=this.deselectable!==t;this.deselectable=t;if(i){this.updateTags()}}}},{key:"isDeselectable",value:function e(){return this.deselectable}},{key:"getTag",value:function e(t){if(t instanceof st){return this.getTags().find((function(e){return e===t}))}else if(r.Type.isPlainObject(t)){var i=t.id,n=t.entityId;return this.getTags().find((function(e){return e.getId()===i&&e.getEntityId()===n}))}return null}},{key:"addTag",value:function e(t){var i=this;if(!r.Type.isObjectLike(t)){throw new Error("TagSelector.addTag: wrong item options.")}if(this.getTag(t)){return null}var a=new st(t);a.setSelector(this);var s=new n.BaseEvent({data:{tag:a}});this.emit("onBeforeTagAdd",s);if(s.isDefaultPrevented()){return null}if(!this.isMultiple()){this.removeTags()}this.tags.push(a);this.emit("onTagAdd",{tag:a});if(this.isRendered()){a.render();this.getItemsContainer().insertBefore(a.getContainer(),this.getTextBox());if(t.animate!==false){a.show().then((function(){i.getContainer().scrollTop=i.getContainer().scrollHeight-i.getContainer().offsetHeight;i.emit("onAfterTagAdd",{tag:a})}))}else{this.emit("onAfterTagAdd",{tag:a})}this.toggleAddButtonCaption()}else{this.emit("onAfterTagAdd",{tag:a})}return a}},{key:"removeTag",value:function e(t){var i=this;var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var a=this.getTag(t);if(!a){return}var s=new n.BaseEvent({data:{tag:a}});this.emit("onBeforeTagRemove",s);if(s.isDefaultPrevented()){return}this.tags=this.tags.filter((function(e){return e!==a}));this.emit("onTagRemove",{tag:a});if(this.isRendered()){a.remove(r).then((function(){i.toggleAddButtonCaption();i.emit("onAfterTagRemove",{tag:a})}))}else{this.emit("onAfterTagRemove",{tag:a})}}},{key:"removeTags",value:function e(){var t=this;this.getTags().forEach((function(e){t.removeTag(e,false)}))}},{key:"getTags",value:function e(){return this.tags}},{key:"renderTo",value:function e(t){var i=this;this.rendered=true;this.getTags().forEach((function(e){e.render();i.getItemsContainer().insertBefore(e.getContainer(),i.getTextBox())}));if(r.Type.isDomNode(t)){r.Dom.append(this.getOuterContainer(),t)}}},{key:"isRendered",value:function e(){return this.rendered}},{key:"updateTags",value:function e(){if(this.isRendered()){this.getTags().forEach((function(e){e.render()}))}}},{key:"getOuterContainer",value:function e(){var t=this;return this.cache.remember("outer-container",(function(){var e=t.isReadonly()?" ui-tag-selector-container-readonly":"";e+=t.isLocked()?" ui-tag-selector-container-locked":"";return r.Tag.render(lt||(lt=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-tag-selector-outer-container','">',"</div>\n\t\t\t"])),e,t.getContainer())}))}},{key:"getContainer",value:function e(){var t=this;return this.cache.remember("container",(function(){var e=t.getMaxHeight()?' style="max-height: '.concat(t.getMaxHeight(),'px; -ms-overflow-style: -ms-autohiding-scrollbar;"'):"";return r.Tag.render(ot||(ot=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div \n\t\t\t\t\tclass="ui-tag-selector-container" \n\t\t\t\t\tonclick="','"\n\t\t\t\t\t',"\n\t\t\t\t>\n\t\t\t\t\t","\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t"])),t.handleContainerClick.bind(t),e,t.getItemsContainer(),t.getCreateButton())}))}},{key:"getItemsContainer",value:function e(){var t=this;return this.cache.remember("items-container",(function(){return r.Tag.render(ut||(ut=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-tag-selector-items">\n\t\t\t\t\t',"\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t"])),t.getTextBox(),t.getAddButton())}))}},{key:"getTextBox",value:function e(){var t=this;return this.cache.remember("text-box",(function(){var e=t.textBoxVisible?"":" ui-tag-selector-item-hidden";var i=r.Tag.render(ht||(ht=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<input \n\t\t\t\t\ttype="text" \n\t\t\t\t\tclass="ui-tag-selector-item ui-tag-selector-text-box','" \n\t\t\t\t\tautocomplete="off"\n\t\t\t\t\tplaceholder="','"\n\t\t\t\t\toninput="','"\n\t\t\t\t\tonblur="','"\n\t\t\t\t\tonkeyup="','"\n\t\t\t\t\tonkeydown="','"\n\t\t\t\t\tvalue=""\n\t\t\t\t>\n\t\t\t'])),e,r.Text.encode(t.getPlaceholder()),t.handleTextBoxInput.bind(t),t.handleTextBoxBlur.bind(t),t.handleTextBoxKeyUp.bind(t),t.handleTextBoxKeyDown.bind(t));var n=t.getTextBoxWidth();if(n!==null){r.Dom.style(i,"width",r.Type.isStringFilled(n)?n:"".concat(n,"px"))}if(t.isLocked()){i.disabled=true}return i}))}},{key:"getItemsHeight",value:function e(){return this.getItemsContainer().scrollHeight}},{key:"calcHeight",value:function e(){if(this.getMaxHeight()!==null){return Math.min(this.getItemsHeight(),this.getMaxHeight())}return Math.max(this.getItemsHeight(),this.getMinHeight())}},{key:"getTextBoxValue",value:function e(){return this.getTextBox().value}},{key:"clearTextBox",value:function e(){this.getTextBox().value="";this.textBoxOldValue=""}},{key:"showTextBox",value:function e(){this.textBoxVisible=true;r.Dom.removeClass(this.getTextBox(),"ui-tag-selector-item-hidden")}},{key:"hideTextBox",value:function e(){this.textBoxVisible=false;r.Dom.addClass(this.getTextBox(),"ui-tag-selector-item-hidden")}},{key:"focusTextBox",value:function e(){this.getTextBox().focus()}},{key:"setTextBoxAutoHide",value:function e(t){if(r.Type.isBoolean(t)){this.textBoxAutoHide=t}}},{key:"getTextBoxWidth",value:function e(){return this.textBoxWidth}},{key:"setTextBoxWidth",value:function e(t){if(r.Type.isStringFilled(t)||t===null){this.textBoxWidth=t;if(this.isRendered()){r.Dom.style(this.getTextBox(),"width",t)}}else if(r.Type.isNumber(t)&&t>0){this.textBoxWidth=t;if(this.isRendered()){r.Dom.style(this.getTextBox(),"width","".concat(t,"px"))}}}},{key:"getTagMaxWidth",value:function e(){return this.tagMaxWidth}},{key:"setTagMaxWidth",value:function e(t){if(r.Type.isNumber(t)&&t>=0||t===null){this.tagMaxWidth=t;this.updateTags()}}},{key:"getTagAvatar",value:function e(){return this.tagAvatar}},{key:"setTagAvatar",value:function e(t){if(r.Type.isString(t)||t===null){this.tagAvatar=t;this.updateTags()}}},{key:"getTagAvatarOptions",value:function e(){return this.tagAvatarOptions}},{key:"getTagAvatarOption",value:function e(t){if(this.tagAvatarOptions!==null&&!r.Type.isUndefined(this.tagAvatarOptions[t])){return this.tagAvatarOptions[t]}return null}},{key:"setTagAvatarOption",value:function e(t,i){if(r.Type.isStringFilled(t)&&!r.Type.isUndefined(i)){if(this.tagAvatarOptions===null){this.tagAvatarOptions={}}this.tagAvatarOptions[t]=i;this.updateTags()}}},{key:"setTagAvatarOptions",value:function e(t){var i=this;if(r.Type.isPlainObject(t)){Object.keys(t).forEach((function(e){i.setTagAvatarOption(e,t[e])}))}}},{key:"getTagTextColor",value:function e(){return this.tagTextColor}},{key:"setTagTextColor",value:function e(t){if(r.Type.isString(t)||t===null){this.tagTextColor=t;this.updateTags()}}},{key:"getTagBgColor",value:function e(){return this.tagBgColor}},{key:"setTagBgColor",value:function e(t){if(r.Type.isString(t)||t===null){this.tagBgColor=t;this.updateTags()}}},{key:"getTagFontWeight",value:function e(){return this.tagFontWeight}},{key:"setTagFontWeight",value:function e(t){if(r.Type.isString(t)||t===null){this.tagFontWeight=t;this.updateTags()}}},{key:"getPlaceholder",value:function e(){return this.placeholder}},{key:"setPlaceholder",value:function e(t){if(r.Type.isStringFilled(t)){this.placeholder=t;if(this.isRendered()){this.getTextBox().placeholder=t}}}},{key:"getMaxHeight",value:function e(){return this.maxHeight}},{key:"getMinHeight",value:function e(){return 33}},{key:"setMaxHeight",value:function e(t){if(r.Type.isNumber(t)&&t>0||t===null){this.maxHeight=t;if(this.isRendered()){r.Dom.style(this.getContainer(),"max-height",t>0?"".concat(t,"px"):null);r.Dom.style(this.getContainer(),"-ms-overflow-style",t>0?"-ms-autohiding-scrollbar":null)}}}},{key:"getAddButton",value:function e(){var t=this;return this.cache.remember("add-button",(function(){var e=t.addButtonVisible?"":" ui-tag-selector-item-hidden";return r.Tag.render(dt||(dt=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<span class="ui-tag-selector-item ui-tag-selector-add-button','">\n\t\t\t\t\t',"\n\t\t\t\t</span>\n\t\t\t"])),e,t.getAddButtonLink())}))}},{key:"getAddButtonLink",value:function e(){var t=this;return this.cache.remember("add-button-link",(function(){var e=r.Text.encode(t.getActualButtonCaption());return r.Tag.render(ct||(ct=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<span \n\t\t\t\t\tclass="ui-tag-selector-add-button-caption" \n\t\t\t\t\tonclick="','">',"</span>\n\t\t\t"])),t.handleAddButtonClick.bind(t),e)}))}},{key:"getAddButtonCaption",value:function e(){return this.addButtonCaption===null?r.Loc.getMessage("UI_TAG_SELECTOR_ADD_BUTTON_CAPTION"):this.addButtonCaption}},{key:"setAddButtonCaption",value:function e(t){if(r.Type.isStringFilled(t)){this.addButtonCaption=t;if(this.isRendered()){this.toggleAddButtonCaption()}}}},{key:"getAddButtonCaptionMore",value:function e(){return this.addButtonCaptionMore===null?this.isMultiple()?r.Loc.getMessage("UI_TAG_SELECTOR_ADD_BUTTON_CAPTION"):r.Loc.getMessage("UI_TAG_SELECTOR_ADD_BUTTON_CAPTION_SINGLE"):this.addButtonCaptionMore}},{key:"setAddButtonCaptionMore",value:function e(t){if(r.Type.isStringFilled(t)){this.addButtonCaptionMore=t;if(this.isRendered()){this.toggleAddButtonCaption()}}}},{key:"toggleAddButtonCaption",value:function e(){if(this.getAddButtonCaptionMore()===null){return}this.getAddButtonLink().textContent=this.getActualButtonCaption()}},{key:"getActualButtonCaption",value:function e(){return this.getTags().length>0&&this.getAddButtonCaptionMore()!==null?this.getAddButtonCaptionMore():this.getAddButtonCaption()}},{key:"showAddButton",value:function e(){this.addButtonVisible=true;r.Dom.removeClass(this.getAddButton(),"ui-tag-selector-item-hidden")}},{key:"hideAddButton",value:function e(){this.addButtonVisible=false;r.Dom.addClass(this.getAddButton(),"ui-tag-selector-item-hidden")}},{key:"getCreateButton",value:function e(){var t=this;return this.cache.remember("create-button",(function(){var e=t.createButtonVisible?"":" ui-tag-selector-item-hidden";return r.Tag.render(gt||(gt=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-tag-selector-create-button','">\n\t\t\t\t\t<span \n\t\t\t\t\t\tclass="ui-tag-selector-create-button-caption"\n\t\t\t\t\t\tonclick="','"\n\t\t\t\t\t>',"</span>\n\t\t\t\t</div>\n\t\t\t"])),e,t.handleCreateButtonClick.bind(t),r.Text.encode(t.getCreateButtonCaption()))}))}},{key:"showCreateButton",value:function e(){this.createButtonVisible=true;r.Dom.removeClass(this.getCreateButton(),"ui-tag-selector-item-hidden")}},{key:"hideCreateButton",value:function e(){this.createButtonVisible=false;r.Dom.addClass(this.getCreateButton(),"ui-tag-selector-item-hidden")}},{key:"getCreateButtonCaption",value:function e(){return this.createButtonCaption===null?r.Loc.getMessage("UI_TAG_SELECTOR_CREATE_BUTTON_CAPTION"):this.createButtonCaption}},{key:"setCreateButtonCaption",value:function e(t){if(r.Type.isStringFilled(t)){this.createButtonCaption=t;if(this.isRendered()){this.getCreateButton().children[0].textContent=t}}}},{key:"handleContainerClick",value:function e(t){this.emit("onContainerClick",{event:t})}},{key:"handleTextBoxInput",value:function e(t){var i=this.getTextBoxValue();if(i!==this.textBoxOldValue){this.textBoxOldValue=i;this.emit("onInput",{event:t})}}},{key:"handleTextBoxBlur",value:function e(t){this.emit("onBlur",{event:t});if(this.textBoxAutoHide){this.clearTextBox();this.showAddButton();this.hideTextBox()}}},{key:"handleTextBoxKeyUp",value:function e(t){this.emit("onKeyUp",{event:t});if(t.key==="Enter"){this.emit("onEnter",{event:t});if(this.textBoxAutoHide){this.clearTextBox();this.showAddButton();this.hideTextBox()}}}},{key:"handleTextBoxKeyDown",value:function e(t){if(t.key==="Enter"){t.preventDefault();if(r.Browser.isMac()&&t.metaKey||t.ctrlKey){this.emit("onMetaEnter",{event:t})}}this.emit("onKeyDown",{event:t})}},{key:"handleAddButtonClick",value:function e(t){this.hideAddButton();this.showTextBox();this.focusTextBox();this.emit("onAddButtonClick",{event:t})}},{key:"handleCreateButtonClick",value:function e(t){this.emit("onCreateButtonClick",{event:t})}}]);return t}(n.EventEmitter);var pt=function(){function e(t){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"dialog",null);babelHelpers.defineProperty(this,"lockedTab",null);babelHelpers.defineProperty(this,"enabled",false);this.dialog=t;this.dialog.subscribe("onShow",this.handleDialogShow.bind(this));this.dialog.subscribe("onHide",this.handleDialogHide.bind(this));this.dialog.subscribe("onDestroy",this.handleDialogDestroy.bind(this));this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this);this.handleDocumentMouseMove=this.handleDocumentMouseMove.bind(this)}babelHelpers.createClass(e,[{key:"getDialog",value:function e(){return this.dialog}},{key:"enable",value:function e(){if(!this.isEnabled()){this.bindEvents()}this.enabled=true}},{key:"disable",value:function e(){if(this.isEnabled()){this.unbindEvents();this.unlockTab()}this.enabled=false}},{key:"isEnabled",value:function e(){return this.enabled}},{key:"bindEvents",value:function e(){r.Event.bind(document,"keydown",this.handleDocumentKeyDown)}},{key:"unbindEvents",value:function e(){r.Event.unbind(document,"keydown",this.handleDocumentKeyDown)}},{key:"getNextNode",value:function e(){if(!this.getActiveNode()){return null}var t=null;var i=this.getActiveNode();if(i.hasChildren()&&i.isOpen()){t=i.getFirstChild()}while(t===null&&i!==null){t=i.getNextSibling();if(t){break}i=i.getParentNode()}return t}},{key:"getPreviousNode",value:function e(){if(!this.getActiveNode()){return null}var t=this.getActiveNode().getPreviousSibling();if(t){while(t.hasChildren()&&t.isOpen()){var i=t.getLastChild();if(i===null){break}t=i}}else{if(this.getActiveNode().getParentNode()&&!this.getActiveNode().getParentNode().isRoot()){t=this.getActiveNode().getParentNode()}}return t}},{key:"getFirstNode",value:function e(){var t=this.getDialog().getActiveTab();return t&&t.getRootNode().getFirstChild()}},{key:"getLastNode",value:function e(){var t=this.getDialog().getActiveTab();if(!t){return null}var i=t.getRootNode().getLastChild();if(i!==null){while(i.hasChildren()&&i.isOpen()){var n=i.getLastChild();if(n===null){break}i=n}}return i}},{key:"getActiveNode",value:function e(){return this.getDialog().getFocusedNode()}},{key:"focusOnNode",value:function e(t){if(t){t.focus();t.scrollIntoView()}}},{key:"lockTab",value:function e(){var t=this.getDialog().getActiveTab();if(this.lockedTab===t){return}else if(this.lockedTab!==null){this.unlockTab()}this.lockedTab=t;this.lockedTab.lock();r.Event.bind(document,"mousemove",this.handleDocumentMouseMove)}},{key:"unlockTab",value:function e(){if(this.lockedTab===null){return}this.lockedTab.unlock();this.lockedTab=null;r.Event.unbind(document,"mousemove",this.handleDocumentMouseMove)}},{key:"handleDialogShow",value:function e(){this.enable()}},{key:"handleDialogHide",value:function e(){this.disable()}},{key:"handleDialogDestroy",value:function e(){this.disable()}},{key:"handleDocumentMouseMove",value:function e(){this.unlockTab()}},{key:"handleDocumentKeyDown",value:function e(t){if(!this.getDialog().isOpen()){this.unbindEvents();return}if(t.metaKey||t.ctrlKey||t.altKey){return}var i=this.getDialog().getActiveTab();if(!i){return}var n=this.constructor.keyMap[t.key]||t.key;if(i===this.getDialog().getSearchTab()&&["ArrowLeft","ArrowRight"].includes(n)){return}var r=this["handle".concat(n,"Press")];if(r){r.call(this,t);this.lockTab(i);t.preventDefault()}}},{key:"handleArrowDownPress",value:function e(){if(!this.getActiveNode()){var t=this.getFirstNode();this.focusOnNode(t)}else{var i=this.getNextNode();if(i){this.focusOnNode(i)}else{var n=this.getFirstNode();this.focusOnNode(n)}}}},{key:"handleArrowUpPress",value:function e(){if(!this.getActiveNode()){var t=this.getLastNode();this.focusOnNode(t)}else{var i=this.getPreviousNode();if(i){this.focusOnNode(i)}else{var n=this.getLastNode();this.focusOnNode(n)}}}},{key:"handleArrowRightPress",value:function e(){if(this.getActiveNode()){this.getActiveNode().expand()}}},{key:"handleArrowLeftPress",value:function e(){if(!this.getActiveNode()){return}if(this.getActiveNode().isOpen()){this.getActiveNode().collapse()}else{var t=this.getActiveNode().getParentNode();if(t&&!t.isRoot()){this.focusOnNode(t)}}}},{key:"handleEnterPress",value:function e(){if(this.getActiveNode()){this.getActiveNode().click()}}},{key:"handleTabPress",value:function e(t){var i=this.getDialog().getActiveTab();if(!i){this.getDialog().selectFirstTab();return}if(t.shiftKey){var n=this.getDialog().getPreviousTab();if(n){this.getDialog().selectTab(n.getId())}else{this.getDialog().selectLastTab()}}else{var r=this.getDialog().getNextTab();if(r){this.getDialog().selectTab(r.getId())}else{this.getDialog().selectFirstTab()}}}}]);return e}();babelHelpers.defineProperty(pt,"keyMap",{Down:"ArrowDown",Up:"ArrowUp",Left:"ArrowLeft",Right:"ArrowRight",Spacebar:"Space"," ":"Space"});var bt=function(){function e(t){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"dialog",null);babelHelpers.defineProperty(this,"sliders",new Set);this.dialog=t;this.dialog.subscribe("onShow",this.handleDialogShow.bind(this));this.dialog.subscribe("onHide",this.handleDialogHide.bind(this));this.dialog.subscribe("onDestroy",this.handleDialogDestroy.bind(this));this.handleSliderOpen=this.handleSliderOpen.bind(this);this.handleSliderClose=this.handleSliderClose.bind(this);this.handleSliderDestroy=this.handleSliderDestroy.bind(this)}babelHelpers.createClass(e,[{key:"getDialog",value:function e(){return this.dialog}},{key:"bindEvents",value:function e(){this.unbindEvents();if(top.BX){top.BX.Event.EventEmitter.subscribe("SidePanel.Slider:onOpen",this.handleSliderOpen);top.BX.Event.EventEmitter.subscribe("SidePanel.Slider:onCloseComplete",this.handleSliderClose);top.BX.Event.EventEmitter.subscribe("SidePanel.Slider:onDestroy",this.handleSliderDestroy)}}},{key:"unbindEvents",value:function e(){if(top.BX){top.BX.Event.EventEmitter.unsubscribe("SidePanel.Slider:onOpen",this.handleSliderOpen);top.BX.Event.EventEmitter.unsubscribe("SidePanel.Slider:onCloseComplete",this.handleSliderClose);top.BX.Event.EventEmitter.unsubscribe("SidePanel.Slider:onDestroy",this.handleSliderDestroy)}}},{key:"isDialogInSlider",value:function e(t){if(t.getFrameWindow()){return t.getFrameWindow().document.contains(this.getDialog().getContainer())}else{return t.getContainer().contains(this.getDialog().getContainer())}}},{key:"handleDialogShow",value:function e(){this.bindEvents()}},{key:"handleDialogHide",value:function e(){this.sliders.clear();this.unbindEvents();this.getDialog().unfreeze()}},{key:"handleDialogDestroy",value:function e(){this.sliders.clear();this.unbindEvents();this.getDialog().unfreeze()}},{key:"handleSliderOpen",value:function e(t){var i=t.getData(),n=babelHelpers.slicedToArray(i,1),r=n[0];var a=r.getSlider();if(!this.isDialogInSlider(a)){this.sliders.add(a);this.getDialog().freeze()}}},{key:"handleSliderClose",value:function e(t){var i=t.getData(),n=babelHelpers.slicedToArray(i,1),r=n[0];var a=r.getSlider();this.sliders["delete"](a);if(this.sliders.size===0){this.getDialog().unfreeze()}}},{key:"handleSliderDestroy",value:function e(t){var i=t.getData(),n=babelHelpers.slicedToArray(i,1),r=n[0];var a=r.getSlider();if(this.isDialogInSlider(a)){this.unbindEvents();this.dialog.destroy()}else{this.sliders["delete"](a);if(this.sliders.size===0){this.getDialog().unfreeze()}}}}]);return e}();var yt;var vt=function(e){babelHelpers.inherits(t,e);function t(e,i){var n;babelHelpers.classCallCheck(this,t);n=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e,i));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(n),"content",null);n.setContent(n.getOption("content"));return n}babelHelpers.createClass(t,[{key:"render",value:function e(){var t=r.Tag.render(yt||(yt=babelHelpers.taggedTemplateLiteral(["\n\t\t\t<div>\n\t\t\t\t","\n\t\t\t</div>\n\t\t"])),this.getContent()?this.getContent():"");var i=this.getOption("containerClass","ui-selector-header-default");var n=this.getOption("containerStyles",{});r.Dom.addClass(t,i);r.Dom.style(t,n);return t}},{key:"getContent",value:function e(){return this.content}},{key:"setContent",value:function e(t){if(r.Type.isStringFilled(t)||r.Type.isDomNode(t)||r.Type.isArrayFilled(t)){this.content=t}}}]);return t}(qe);var Tt;var mt=function(e){babelHelpers.inherits(t,e);function t(e,i){var n;babelHelpers.classCallCheck(this,t);n=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e,i));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(n),"content",null);n.setContent(n.getOption("content"));return n}babelHelpers.createClass(t,[{key:"render",value:function e(){var t=r.Tag.render(Tt||(Tt=babelHelpers.taggedTemplateLiteral(["\n\t\t\t<div>\n\t\t\t\t","\n\t\t\t</div>\n\t\t"])),this.getContent()?this.getContent():"");var i=this.getOption("containerClass","ui-selector-footer-default");var n=this.getOption("containerStyles",{});r.Dom.addClass(t,i);r.Dom.style(t,n);return t}},{key:"getContent",value:function e(){return this.content}},{key:"setContent",value:function e(t){if(r.Type.isStringFilled(t)||r.Type.isDomNode(t)||r.Type.isArrayFilled(t)){this.content=t}}}]);return t}(Xe);var Ct=function(e){babelHelpers.inherits(t,e);function t(e,i){babelHelpers.classCallCheck(this,t);var n="data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2223%22%20height%3D%2223%22%20fill%3D%"+"22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M14.432%2013.985a.96."+"96%200%2000-.96-.96H8.505a.96.96%200%20000%201.92h4.967c.53%200%20.96-.43.96-.96zM14.432%2011."+"009a.96.96%200%2000-.96-.96H8.505a.96.96%200%20000%201.92h4.967c.53%200%20.96-.43.96-.96zM14."+"432%208.033a.96.96%200%2000-.96-.96H8.505a.96.96%200%20000%201.92h4.967c.53%200%20.96-.43.96-."+"96z%22%20fill%3D%22%23ABB1B8%22/%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd"+"%22%20d%3D%22M10.988%2019.52c1.8%200%203.469-.558%204.844-1.51l2.205%202.204a1.525%201.525%200%20"+"102.157-2.157l-2.205-2.205a8.512%208.512%200%2010-7%203.668zm0-2.403a6.108%206.108%200%20100-12.2"+"16%206.108%206.108%200%20000%2012.216z%22%20fill%3D%22%23ABB1B8%22/%3E%3C/svg%3E";var a={title:r.Loc.getMessage("UI_SELECTOR_RECENT_TAB_TITLE"),itemOrder:{sort:"asc"},visible:!e.isDropdownMode(),stub:!e.isDropdownMode(),icon:{default:n,selected:n.replace(/ABB1B8/g,"fff")}};var s=Object.assign({},a,i);s.id="recents";return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e,s))}return t}(Ye);var kt=function(){function e(t,i){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"item",null);babelHelpers.defineProperty(this,"queryWords",null);babelHelpers.defineProperty(this,"matchFields",new Map);babelHelpers.defineProperty(this,"sort",null);this.item=t;this.queryWords=i;this.addIndexes(n)}babelHelpers.createClass(e,[{key:"getItem",value:function e(){return this.item}},{key:"getQueryWords",value:function e(){return this.queryWords}},{key:"getMatchFields",value:function e(){return this.matchFields}},{key:"getSort",value:function e(){return this.sort}},{key:"addIndex",value:function e(t){var i=this.matchFields.get(t.getField());if(!i){i=new f(t.getField());this.matchFields.set(t.getField(),i);var n=t.getField().getSort();if(n!==null){this.sort=this.sort===null?n:Math.min(this.sort,n)}}i.addIndex(t)}},{key:"addIndexes",value:function e(t){var i=this;t.forEach((function(e){i.addIndex(e)}))}}]);return e}();var St=new Intl.Collator(undefined,{sensitivity:"base"});var Ht=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"matchItems",value:function e(t,i){var n=[];var r=i.getQueryWords();var a=i.getResultLimit();for(var s=0;s<t.length;s++){if(a===0){break}var l=t[s];if(l.isSelected()||!l.isSearchable()||l.isHidden()||!l.getEntity().isSearchable()){continue}var o=this.matchItem(l,r);if(o){n.push(o);a--}}return n}},{key:"matchItem",value:function e(t,i){var n=[];for(var r=0;r<i.length;r++){var a=i[r];var s=this.matchWord(t,a);if(s.length===0){return null}else{n=n.concat(s)}}if(n.length>0){return new kt(t,i,n)}else{return null}}},{key:"matchWord",value:function e(t,i){var n=t.getSearchIndex().getIndexes();var r=[];for(var a=0;a<n.length;a++){var s=n[a];var l=s.getIndexes();for(var o=0;o<l.length;o++){var u=l[o];var h=u.getWord().substring(0,i.length);if(St.compare(i,h)===0){r.push(new c(s.getField(),i,u.getStartIndex()))}}if(r.length>0){break}}return r}}]);return e}();var xt=function(){function e(t){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"queryWords",[]);babelHelpers.defineProperty(this,"query","");babelHelpers.defineProperty(this,"cacheable",true);babelHelpers.defineProperty(this,"dynamicSearchEntities",[]);babelHelpers.defineProperty(this,"resultLimit",100);this.query=t.trim().replace(/\s\s+/g," ");this.queryWords=r.Type.isStringFilled(this.query)?this.query.split(" "):[]}babelHelpers.createClass(e,[{key:"getQueryWords",value:function e(){return this.queryWords}},{key:"getQuery",value:function e(){return this.query}},{key:"isEmpty",value:function e(){return this.getQueryWords().length===0}},{key:"setCacheable",value:function e(t){if(r.Type.isBoolean(t)){this.cacheable=t}}},{key:"isCacheable",value:function e(){return this.cacheable}},{key:"setResultLimit",value:function e(t){if(r.Type.isNumber(t)&&t>=0){this.resultLimit=t}}},{key:"getResultLimit",value:function e(){return this.resultLimit}},{key:"hasDynamicSearch",value:function e(){return this.getDynamicSearchEntities().length>0}},{key:"hasDynamicSearchEntity",value:function e(t){return this.getDynamicSearchEntities().includes(t)}},{key:"setDynamicSearchEntities",value:function e(t){var i=this;if(r.Type.isArrayFilled(t)){t.forEach((function(e){if(r.Type.isStringFilled(e)&&!i.hasDynamicSearchEntity(e)){i.dynamicSearchEntities.push(e)}}))}return this.dynamicSearchEntities}},{key:"getDynamicSearchEntities",value:function e(){return this.dynamicSearchEntities}},{key:"getAjaxJson",value:function e(){return this.toJSON()}},{key:"toJSON",value:function e(){return{queryWords:this.getQueryWords(),query:this.getQuery(),dynamicSearchEntities:this.getDynamicSearchEntities()}}}]);return e}();var It,Ot,Dt,Pt,Et;var At=function(){function e(t){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"tab",null);babelHelpers.defineProperty(this,"loader",null);babelHelpers.defineProperty(this,"cache",new r.Cache.MemoryCache);this.tab=t}babelHelpers.createClass(e,[{key:"getTab",value:function e(){return this.tab}},{key:"getLoader",value:function e(){if(this.loader===null){this.loader=new a.Loader({target:this.getIconContainer(),size:32})}return this.loader}},{key:"getContainer",value:function e(){var t=this;return this.cache.remember("container",(function(){return r.Tag.render(It||(It=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-selector-search-loader">\n\t\t\t\t\t',"\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t"])),t.getBoxContainer(),t.getSpacerContainer())}))}},{key:"getBoxContainer",value:function e(){var t=this;return this.cache.remember("box-container",(function(){return r.Tag.render(Ot||(Ot=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-selector-search-loader-box">\n\t\t\t\t\t',"\n\t\t\t\t\t","\n\t\t\t\t</div>"])),t.getIconContainer(),t.getTextContainer())}))}},{key:"getIconContainer",value:function e(){return this.cache.remember("icon",(function(){return r.Tag.render(Dt||(Dt=babelHelpers.taggedTemplateLiteral(['<div class="ui-selector-search-loader-icon"></div>'])))}))}},{key:"getTextContainer",value:function e(){return this.cache.remember("text",(function(){return r.Tag.render(Pt||(Pt=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-selector-search-loader-text">',"</div>\n\t\t\t"])),r.Loc.getMessage("UI_SELECTOR_SEARCH_LOADER_TEXT"))}))}},{key:"getSpacerContainer",value:function e(){return this.cache.remember("spacer",(function(){return r.Tag.render(Et||(Et=babelHelpers.taggedTemplateLiteral(['<div class="ui-selector-search-loader-spacer"></div>'])))}))}},{key:"show",value:function e(){var t=this;if(!this.getContainer().parentNode){r.Dom.append(this.getContainer(),this.getTab().getContainer())}void this.getLoader().show();r.Dom.addClass(this.getContainer(),"ui-selector-search-loader--show");requestAnimationFrame((function(){r.Dom.addClass(t.getContainer(),"ui-selector-search-loader--animate")}))}},{key:"hide",value:function e(){if(this.loader===null){return}r.Dom.removeClass(this.getContainer(),["ui-selector-search-loader--show","ui-selector-search-loader--animate"]);void this.getLoader().hide()}},{key:"isShown",value:function e(){return this.loader!==null&&this.loader.isShown()}}]);return e}();var wt,Lt,Bt,Nt;var Ft=function(e){babelHelpers.inherits(t,e);function t(e,i){var n;babelHelpers.classCallCheck(this,t);n=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e,i));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(n),"loader",null);n.getDialog().subscribe("onSearch",n.handleOnSearch.bind(babelHelpers.assertThisInitialized(n)));var r=n.getDialog().getTagSelector();if(r){r.subscribe("onMetaEnter",n.handleMetaEnter.bind(babelHelpers.assertThisInitialized(n)))}return n}babelHelpers.createClass(t,[{key:"render",value:function e(){return r.Tag.render(wt||(wt=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="ui-selector-search-footer" onclick="','">\n\t\t\t\t<div class="ui-selector-search-footer-box">\n\t\t\t\t\t',"\n\t\t\t\t\t","\n\t\t\t\t\t",'\n\t\t\t\t</div>\n\t\t\t\t<div class="ui-selector-search-footer-cmd">',"</div>\n\t\t\t</div>\n\t\t"])),this.handleClick.bind(this),this.getLabelContainer(),this.getQueryContainer(),this.getLoaderContainer(),r.Browser.isMac()?"&#8984;+Enter":"Ctrl+Enter")}},{key:"getLoader",value:function e(){if(this.loader===null){this.loader=new a.Loader({target:this.getLoaderContainer(),size:17,color:"rgba(82, 92, 105, 0.9)"})}return this.loader}},{key:"showLoader",value:function e(){void this.getLoader().show()}},{key:"hideLoader",value:function e(){void this.getLoader().hide()}},{key:"setLabel",value:function e(t){if(r.Type.isString(t)){this.getLabelContainer().textContent=t}}},{key:"getLabelContainer",value:function e(){var t=this;return this.cache.remember("label",(function(){return r.Tag.render(Lt||(Lt=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<span class="ui-selector-search-footer-label">',"</span>\n\t\t\t"])),t.getOption("label",r.Loc.getMessage("UI_SELECTOR_CREATE_ITEM_LABEL")))}))}},{key:"getQueryContainer",value:function e(){return this.cache.remember("name-container",(function(){return r.Tag.render(Bt||(Bt=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<span class="ui-selector-search-footer-query"></span>\n\t\t\t'])))}))}},{key:"getLoaderContainer",value:function e(){return this.cache.remember("loader",(function(){return r.Tag.render(Nt||(Nt=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-selector-search-footer-loader"></div>\n\t\t\t'])))}))}},{key:"createItem",value:function e(){var t=this;var i=this.getDialog().getTagSelector();if(i&&i.isLocked()){return}var n=function e(){t.hideLoader();if(t.getDialog().getTagSelector()){t.getDialog().getTagSelector().unlock();t.getDialog().focusSearch()}};event.preventDefault();this.showLoader();if(i){i.lock()}this.getDialog().emitAsync("Search:onItemCreateAsync",{searchQuery:this.getTab().getLastSearchQuery()}).then((function(){t.getTab().clearResults();t.getDialog().clearSearch();if(t.getDialog().getActiveTab()===t.getTab()){t.getDialog().selectFirstTab()}n()}))["catch"]((function(){n()}))}},{key:"handleClick",value:function e(){this.createItem()}},{key:"handleMetaEnter",value:function e(t){if(this.getDialog().getActiveTab()!==this.getTab()){return}this.handleClick()}},{key:"handleOnSearch",value:function e(t){var i=t.getData(),n=i.query;this.getQueryContainer().textContent=n}}]);return t}(Xe);var Rt=function(e){babelHelpers.inherits(t,e);function t(e,i,n){var a;babelHelpers.classCallCheck(this,t);var s={title:r.Loc.getMessage("UI_SELECTOR_SEARCH_TAB_TITLE"),visible:false,stub:true,stubOptions:{autoShow:false,title:r.Loc.getMessage("UI_SELECTOR_SEARCH_STUB_TITLE"),subtitle:r.Loc.getMessage("UI_SELECTOR_SEARCH_STUB_SUBTITLE")}};var l=Object.assign({},s,i);l.id="search";l.stubOptions.autoShow=false;a=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e,l));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(a),"lastSearchQuery",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(a),"queryCache",new Set);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(a),"queryXhr",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(a),"searchLoader",new At(babelHelpers.assertThisInitialized(a)));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(a),"allowCreateItem",false);n=r.Type.isPlainObject(n)?n:{};a.setAllowCreateItem(n.allowCreateItem,n.footerOptions);a.loadWithDebounce=r.Runtime.debounce((function(){a.load(a.getLastSearchQuery())}),500);return a}babelHelpers.createClass(t,[{key:"search",value:function e(t){var i=new xt(t);var n=this.getDynamicEntities(i);i.setDynamicSearchEntities(n);if(i.isEmpty()){this.getSearchLoader().hide();return}this.lastSearchQuery=i;var r=Ht.matchItems(this.getDialog().getItems(),i);this.clearResults();this.appendResults(r);if(this.getDialog().shouldFocusOnFirst()){this.getDialog().focusOnFirstNode()}if(this.shouldLoad(i)){this.loadWithDebounce();if(!this.isEmptyResult()){this.getStub().hide()}}else{if(!this.getSearchLoader().isShown()){this.toggleEmptyResult()}}}},{key:"getLastSearchQuery",value:function e(){return this.lastSearchQuery}},{key:"setAllowCreateItem",value:function e(t,i){if(r.Type.isBoolean(t)){this.allowCreateItem=t;if(t){this.setFooter(Ft,i)}else{this.setFooter(null)}}}},{key:"canCreateItem",value:function e(){return this.allowCreateItem}},{key:"appendResults",value:function e(t){var i=this;t.sort((function(e,t){var i=e.getSort();var n=t.getSort();if(i!==null&&n!==null&&i!==n){return i-n}if(i!==null&&n===null){return-1}else if(i===null&&n!==null){return 1}var r=e.getItem().getContextSort();var a=t.getItem().getContextSort();if(r!==null&&a===null){return-1}else if(r===null&&a!==null){return 1}else if(r!==null&&a!==null){return a-r}else{var s=e.getItem().getGlobalSort();var l=t.getItem().getGlobalSort();if(s!==null&&l===null){return-1}else if(s===null&&l!==null){return 1}else if(s!==null&&l!==null){return l-s}return 0}}));this.getRootNode().disableRender();t.forEach((function(e){var t=e.getItem();if(!i.getRootNode().hasItem(t)){var n=i.getRootNode().addItem(t);n.setHighlights(e.getMatchFields())}}));this.getRootNode().enableRender();this.getRootNode().render(true)}},{key:"getDynamicEntities",value:function e(t){var i=[];this.getDialog().getEntities().forEach((function(e){if(e.isSearchable()){var n=e.getSearchCacheLimits().some((function(e){return e.test(t.getQuery())}));if(n){i.push(e.getId())}}}));return i}},{key:"isQueryCacheable",value:function e(t){return t.isCacheable()&&!t.hasDynamicSearch()}},{key:"isQueryLoaded",value:function e(t){var i=false;this.queryCache.forEach((function(e){if(i===false&&t.getQuery().startsWith(e)){i=true}}));return i}},{key:"addCacheQuery",value:function e(t){if(this.isQueryCacheable(t)){this.queryCache.add(t.getQuery())}}},{key:"removeCacheQuery",value:function e(t){this.queryCache["delete"](t.getQuery())}},{key:"shouldLoad",value:function e(t){if(!this.isQueryCacheable(t)){return true}if(!this.getDialog().hasDynamicSearch()){return false}return!this.isQueryLoaded(t)}},{key:"load",value:function e(t){var i=this;if(!this.shouldLoad(t)){return}this.addCacheQuery(t);this.getStub().hide();this.getSearchLoader().show();r.ajax.runAction("ui.entityselector.doSearch",{json:{dialog:this.getDialog().getAjaxJson(),searchQuery:t.getAjaxJson()},onrequeststart:function e(t){i.queryXhr=t},getParameters:{context:this.getDialog().getContext()}}).then((function(e){i.getSearchLoader().hide();if(!e||!e.data||!e.data.dialog||!e.data.dialog.items){i.removeCacheQuery(t);i.toggleEmptyResult();i.getDialog().emit("SearchTab:onLoad",{searchTab:i});return}if(e.data.searchQuery&&e.data.searchQuery.cacheable===false){i.removeCacheQuery(t)}if(r.Type.isArrayFilled(e.data.dialog.items)){var n=new Set;e.data.dialog.items.forEach((function(e){delete e.tabs;delete e.children;var t=i.getDialog().addItem(e);n.add(t)}));var a=i.isEmptyResult();var s=Ht.matchItems(Array.from(n.values()),i.getLastSearchQuery());i.appendResults(s);if(a&&i.getDialog().shouldFocusOnFirst()){i.getDialog().focusOnFirstNode()}}i.toggleEmptyResult();i.getDialog().emit("SearchTab:onLoad",{searchTab:i})}))["catch"]((function(e){i.removeCacheQuery(t);i.getSearchLoader().hide();i.toggleEmptyResult();console.error(e)}))}},{key:"getSearchLoader",value:function e(){return this.searchLoader}},{key:"clearResults",value:function e(){this.getRootNode().removeChildren()}},{key:"isEmptyResult",value:function e(){return!this.getRootNode().hasChildren()}},{key:"toggleEmptyResult",value:function e(){if(this.isEmptyResult()){this.getStub().show()}else{this.getStub().hide()}}}]);return t}(Ye);var Mt,jt,zt,Wt,Ut,_t,Vt;var qt=function e(){babelHelpers.classCallCheck(this,e)};babelHelpers.defineProperty(qt,"UNSENT","UNSENT");babelHelpers.defineProperty(qt,"LOADING","LOADING");babelHelpers.defineProperty(qt,"DONE","DONE");var Qt=function e(){babelHelpers.classCallCheck(this,e)};babelHelpers.defineProperty(Qt,"INSIDE","INSIDE");babelHelpers.defineProperty(Qt,"OUTSIDE","OUTSIDE");var Xt=new Map;var Gt=function(e){babelHelpers.inherits(i,e);babelHelpers.createClass(i,null,[{key:"getById",value:function e(t){return Xt.get(t)||null}},{key:"getInstances",value:function e(){return Array.from(Xt.values())}}]);function i(e){var t;babelHelpers.classCallCheck(this,i);t=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(i).call(this));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"id",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"items",new Map);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"tabs",new Map);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"entities",new Map);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"targetNode",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"popup",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"cache",new r.Cache.MemoryCache);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"multiple",true);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"hideOnSelect",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"hideOnDeselect",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"clearSearchOnSelect",true);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"context",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"selectedItems",new Set);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"preselectedItems",[]);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"undeselectedItems",[]);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"dropdownMode",false);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"frozen",false);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"frozenProps",{});babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"hideByEsc",true);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"autoHide",true);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"autoHideHandler",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"offsetTop",5);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"offsetLeft",0);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"cacheable",true);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"width",565);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"height",420);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"maxLabelWidth",160);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"minLabelWidth",45);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"showAvatars",true);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"compactView",false);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"activeTab",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"recentTab",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"searchTab",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"rendered",false);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"loadState",qt.UNSENT);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"loader",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"tagSelector",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"tagSelectorMode",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"tagSelectorHeight",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"saveRecentItemsWithDebounce",r.Runtime.debounce(t.saveRecentItems,2e3,babelHelpers.assertThisInitialized(t)));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"recentItemsToSave",[]);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"navigation",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"header",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"footer",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"popupOptions",{});babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"focusOnFirst",true);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"focusedNode",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"clearUnavailableItems",false);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(t),"overlappingObserver",null);t.setEventNamespace("BX.UI.EntitySelector.Dialog");var n=r.Type.isPlainObject(e)?e:{};t.id=r.Type.isStringFilled(n.id)?n.id:"ui-selector-".concat(r.Text.getRandom().toLowerCase());t.multiple=r.Type.isBoolean(n.multiple)?n.multiple:true;t.context=r.Type.isStringFilled(n.context)?n.context:null;t.clearUnavailableItems=n.clearUnavailableItems===true;t.compactView=n.compactView===true;t.dropdownMode=r.Type.isBoolean(n.dropdownMode)?n.dropdownMode:false;if(r.Type.isArray(n.entities)){n.entities.forEach((function(e){t.addEntity(e)}))}if(n.tagSelector instanceof ft){t.tagSelectorMode=Qt.OUTSIDE;t.setTagSelector(n.tagSelector)}else if(n.enableSearch===true){var a={placeholder:r.Loc.getMessage("UI_TAG_SELECTOR_SEARCH_PLACEHOLDER"),maxHeight:99,textBoxWidth:105};var s=r.Type.isPlainObject(n.tagSelectorOptions)?n.tagSelectorOptions:{};var l={dialogOptions:null,showTextBox:true,showAddButton:false,showCreateButton:false,multiple:t.isMultiple()};var o=Object.assign(a,s,l);var u=new ft(o);t.tagSelectorMode=Qt.INSIDE;t.setTagSelector(u)}t.setTargetNode(n.targetNode);t.setHideOnSelect(n.hideOnSelect);t.setHideOnDeselect(n.hideOnDeselect);t.setClearSearchOnSelect(n.clearSearchOnSelect);t.setWidth(n.width);void t.setHeight(n.height);t.setAutoHide(n.autoHide);t.setAutoHideHandler(n.autoHideHandler);t.setHideByEsc(n.hideByEsc);t.setOffsetLeft(n.offsetLeft);t.setOffsetTop(n.offsetTop);t.setCacheable(n.cacheable);t.setFocusOnFirst(n.focusOnFirst);t.setShowAvatars(n.showAvatars);t.recentTab=new Ct(babelHelpers.assertThisInitialized(t),n.recentTabOptions);t.searchTab=new Rt(babelHelpers.assertThisInitialized(t),n.searchTabOptions,n.searchOptions);t.addTab(t.recentTab);t.addTab(t.searchTab);t.setPreselectedItems(n.preselectedItems);t.setUndeselectedItems(n.undeselectedItems);t.setOptions(n);var h=n.preload===true||t.getPreselectedItems().length>0;if(h){t.load()}if(r.Type.isPlainObject(n.popupOptions)){var d=["overlay","bindOptions","targetContainer","zIndexOptions"];var c={};Object.keys(n.popupOptions).forEach((function(e){if(d.includes(e)){c[e]=n.popupOptions[e]}}));t.popupOptions=c}t.navigation=new pt(babelHelpers.assertThisInitialized(t));new bt(babelHelpers.assertThisInitialized(t));t.subscribe("ItemNode:onFocus",t.handleItemNodeFocus.bind(babelHelpers.assertThisInitialized(t)));t.subscribe("ItemNode:onUnfocus",t.handleItemNodeUnfocus.bind(babelHelpers.assertThisInitialized(t)));t.subscribeFromOptions(n.events);Xt.set(t.id,babelHelpers.assertThisInitialized(t));return t}babelHelpers.createClass(i,[{key:"show",value:function e(){this.load();this.getPopup().show()}},{key:"hide",value:function e(){this.getPopup().close()}},{key:"destroy",value:function e(){if(this.destroying){return}this.destroying=true;this.emit("onDestroy");this.disconnectTabOverlapping();Xt["delete"](this.getId());if(this.isRendered()){this.getPopup().destroy()}for(var t in this){if(this.hasOwnProperty(t)){delete this[t]}}Object.setPrototypeOf(this,null)}},{key:"isOpen",value:function e(){return this.popup&&this.popup.isShown()}},{key:"adjustPosition",value:function e(){if(this.isRendered()){this.getPopup().adjustPosition()}}},{key:"search",value:function e(t){var i=r.Type.isStringFilled(t)?t.trim():"";var a=new n.BaseEvent({data:{query:i}});this.emit("onBeforeSearch",a);if(a.isDefaultPrevented()){return}if(!r.Type.isStringFilled(i)){this.selectFirstTab();if(this.getSearchTab()){this.getSearchTab().clearResults()}}else if(this.getSearchTab()){this.selectTab(this.getSearchTab().getId());this.getSearchTab().search(i)}this.emit("onSearch",{query:i})}},{key:"addItem",value:function e(t){var i=this;if(!r.Type.isPlainObject(t)){throw new Error("EntitySelector.addItem: wrong item options.")}var n=this.getItem(t);if(!n){n=new Ne(t);var a=this.getUndeselectedItems().some((function(e){return e[0]===n.getEntityId()&&String(e[1])===String(n.getId())}));if(a){n.setDeselectable(false)}n.setDialog(this);var s=this.getEntity(n.getEntityId());if(s===null){this.addEntity({id:n.getEntityId()})}var l=this.items.get(n.getEntityId());if(!l){l=new Map;this.items.set(n.getEntityId(),l)}l.set(String(n.getId()),n);if(n.isSelected()){this.handleItemSelect(n)}}var o=[];if(r.Type.isArray(t.tabs)){o=t.tabs}else if(r.Type.isStringFilled(t.tabs)){o=[t.tabs]}var u=r.Type.isArray(t.children)?t.children:[];o.forEach((function(e){var r=i.getTab(e);if(r){var a=r.getRootNode().addItem(n,t.nodeOptions);a.addChildren(u)}}));return n}},{key:"removeItem",value:function e(t){t=this.getItem(t);if(t){this.handleItemDeselect(t);t.getNodes().forEach((function(e){e.getParentNode().removeChild(e)}));var i=this.getEntityItemsInternal(t.getEntityId());if(i){i["delete"](String(t.getId()));if(i.size===0){this.items["delete"](t.getEntityId())}}}return t}},{key:"removeItems",value:function e(){var t=this;this.getItemsInternal().forEach((function(e){e.forEach((function(e){t.removeItem(e)}))}))}},{key:"getItem",value:function e(t){var i=null;var n=null;if(r.Type.isArray(t)&&t.length===2){var a=babelHelpers.slicedToArray(t,2);n=a[0];i=a[1]}else if(t instanceof Ne){i=t.getId();n=t.getEntityId()}else if(r.Type.isObjectLike(t)){i=t.id;n=t.entityId}var s=this.getEntityItemsInternal(n);if(s){return s.get(String(i))||null}return null}},{key:"getSelectedItems",value:function e(){return Array.from(this.selectedItems)}},{key:"getItems",value:function e(){var t=[];this.getItemsInternal().forEach((function(e){Array.prototype.push.apply(t,Array.from(e.values()))}));return t}},{key:"getItemsInternal",value:function e(){return this.items}},{key:"getEntityItems",value:function e(t){var i=this.getEntityItemsInternal(t);return i===null?[]:Array.from(i.values())}},{key:"getEntityItemsInternal",value:function e(t){return this.items.get(t)||null}},{key:"validateItemIds",value:function e(t){if(!r.Type.isArrayFilled(t)){return[]}var i=[];t.forEach((function(e){if(!r.Type.isArray(e)||e.length!==2){return}var t=babelHelpers.slicedToArray(e,2),n=t[0],a=t[1];if(r.Type.isStringFilled(n)&&(r.Type.isStringFilled(a)||r.Type.isNumber(a))){i.push(e)}}));return i}},{key:"addTab",value:function e(t){if(r.Type.isPlainObject(t)){t=new Ye(this,t)}if(!(t instanceof Ye)){throw new Error("EntitySelector: a tab must be an instance of EntitySelector.Tab.")}if(this.getTab(t.getId())){console.error('EntitySelector: the "'.concat(t.getId(),'" tab is already existed.'));return t}t.setDialog(this);this.tabs.set(t.getId(),t);if(this.isRendered()){this.insertTab(t)}return t}},{key:"getTabs",value:function e(){return Array.from(this.tabs.values())}},{key:"getTab",value:function e(t){return this.tabs.get(t)||null}},{key:"getRecentTab",value:function e(){return this.recentTab}},{key:"getSearchTab",value:function e(){return this.searchTab}},{key:"selectTab",value:function e(t){var i=this;var n=this.getTab(t);if(!n||n===this.getActiveTab()){return n}if(this.getActiveTab()){this.getActiveTab().deselect()}this.activeTab=n;n.select();if(!n.isRendered()){n.render()}requestAnimationFrame((function(){requestAnimationFrame((function(){i.focusSearch()}))}));this.clearNodeFocus();if(this.shouldFocusOnFirst()){this.focusOnFirstNode()}this.adjustHeader();this.adjustFooter();return n}},{key:"insertTab",value:function e(t){t.renderLabel();t.renderContainer();r.Dom.append(t.getLabelContainer(),this.getLabelsContainer());r.Dom.append(t.getContainer(),this.getTabContentsContainer());if(t.getHeader()){r.Dom.append(t.getHeader().getContainer(),this.getHeaderContainer())}if(t.getFooter()){r.Dom.append(t.getFooter().getContainer(),this.getFooterContainer())}}},{key:"selectFirstTab",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var i=this.getTabs();for(var n=0;n<i.length;n++){var r=i[n];if(t===false||r.isVisible()){return this.selectTab(r.getId())}}if(this.isDropdownMode()){return this.selectTab(this.getRecentTab().getId())}return null}},{key:"selectLastTab",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var i=this.getTabs();for(var n=i.length-1;n>=0;n--){var r=i[n];if(t===false||r.isVisible()){return this.selectTab(r.getId())}}if(this.isDropdownMode()){return this.selectTab(this.getRecentTab().getId())}return null}},{key:"getActiveTab",value:function e(){return this.activeTab}},{key:"getNextTab",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var i=null;var n=false;var r=this.getTabs();for(var a=0;a<r.length;a++){var s=r[a];if(t&&!s.isVisible()){continue}if(s===this.getActiveTab()){n=true}else if(n){i=s;break}}return i}},{key:"getPreviousTab",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var i=null;var n=false;var r=this.getTabs();for(var a=r.length-1;a>=0;a--){var s=r[a];if(t&&!s.isVisible()){continue}if(s===this.getActiveTab()){n=true}else if(n){i=s;break}}return i}},{key:"removeTab",value:function e(t){var i=this.getTab(t);if(!i){return}i.getRootNode().removeChildren();this.tabs["delete"](t);r.Dom.remove(i.getLabelContainer(),this.getLabelsContainer());r.Dom.remove(i.getContainer(),this.getTabContentsContainer());if(i.getHeader()){r.Dom.remove(i.getHeader().getContainer(),this.getHeaderContainer())}if(i.getFooter()){r.Dom.remove(i.getFooter().getContainer(),this.getFooterContainer())}this.selectFirstTab()}},{key:"addEntity",value:function e(t){if(r.Type.isPlainObject(t)){t=new Pe(t)}if(!(t instanceof Pe)){throw new Error("EntitySelector: an entity must be an instance of EntitySelector.Entity.")}if(this.hasEntity(t.getId())){console.error('EntitySelector: the "'.concat(t.getId(),'" entity is already existed.'));return t}this.entities.set(t.getId(),t);return t}},{key:"getEntity",value:function e(t){return this.entities.get(t)||null}},{key:"hasEntity",value:function e(t){return this.entities.has(t)}},{key:"getEntities",value:function e(){return Array.from(this.entities.values())}},{key:"removeEntity",value:function e(t){this.removeEntityItems(t);this.entities["delete"](t)}},{key:"removeEntityItems",value:function e(t){var i=this;var n=this.getEntityItemsInternal(t);if(n){n.forEach((function(e){i.removeItem(e)}))}}},{key:"getHeader",value:function e(){return this.header}},{key:"getActiveHeader",value:function e(){if(!this.getActiveTab()){return null}if(this.getActiveTab().getHeader()){return this.getActiveTab().getHeader()}return this.getHeader()&&this.getActiveTab().canShowDefaultHeader()?this.getHeader():null}},{key:"adjustHeader",value:function e(){if(!this.getActiveTab()){return}if(this.getActiveTab().getHeader()){if(this.getHeader()){this.getHeader().hide()}this.getActiveTab().getHeader().show()}else{if(this.getHeader()){if(this.getActiveTab().canShowDefaultHeader()){this.getHeader().show()}else{this.getHeader().hide()}}}}},{key:"setHeader",value:function e(t,i){var n=null;if(t!==null){n=this.constructor.createHeader(this,t,i);if(n===null){return null}}if(this.isRendered()&&this.getHeader()!==null){r.Dom.remove(this.getHeader().getContainer());this.adjustHeader()}this.header=n;if(this.isRendered()){this.appendHeader(n);this.adjustHeader()}return n}},{key:"appendHeader",value:function e(t){if(t instanceof qe){r.Dom.append(t.getContainer(),this.getHeaderContainer())}}},{key:"getFooter",value:function e(){return this.footer}},{key:"getActiveFooter",value:function e(){if(!this.getActiveTab()){return null}if(this.getActiveTab().getFooter()){return this.getActiveTab().getFooter()}return this.getFooter()&&this.getActiveTab().canShowDefaultFooter()?this.getFooter():null}},{key:"adjustFooter",value:function e(){if(!this.getActiveTab()){return}if(this.getActiveTab().getFooter()){if(this.getFooter()){this.getFooter().hide()}this.getActiveTab().getFooter().show()}else{if(this.getFooter()){if(this.getActiveTab().canShowDefaultFooter()){this.getFooter().show()}else{this.getFooter().hide()}}}}},{key:"setFooter",value:function e(t,i){var n=null;if(t!==null){n=this.constructor.createFooter(this,t,i);if(n===null){return null}}if(this.isRendered()&&this.getFooter()!==null){r.Dom.remove(this.getFooter().getContainer());this.adjustFooter()}this.footer=n;if(this.isRendered()){this.appendFooter(n);this.adjustFooter()}return n}},{key:"appendFooter",value:function e(t){if(t instanceof Xe){r.Dom.append(t.getContainer(),this.getFooterContainer())}}},{key:"getId",value:function e(){return this.id}},{key:"getContext",value:function e(){return this.context}},{key:"getNavigation",value:function e(){return this.navigation}},{key:"deselectAll",value:function e(){this.getSelectedItems().forEach((function(e){e.deselect()}))}},{key:"isMultiple",value:function e(){return this.multiple}},{key:"setTargetNode",value:function e(t){if(!r.Type.isDomNode(t)&&!r.Type.isNull(t)&&!r.Type.isObject(t)){return}this.targetNode=t;if(this.isRendered()){this.getPopup().setBindElement(this.targetNode);this.getPopup().adjustPosition()}}},{key:"getTargetNode",value:function e(){if(this.targetNode===null){if(this.getTagSelectorMode()===Qt.OUTSIDE){return this.getTagSelector().getOuterContainer()}}return this.targetNode}},{key:"setHideOnSelect",value:function e(t){if(r.Type.isBoolean(t)){this.hideOnSelect=t}}},{key:"shouldHideOnSelect",value:function e(){if(this.hideOnSelect!==null){return this.hideOnSelect}return!this.isMultiple()}},{key:"setHideOnDeselect",value:function e(t){if(r.Type.isBoolean(t)){this.hideOnDeselect=t}}},{key:"shouldHideOnDeselect",value:function e(){if(this.hideOnDeselect!==null){return this.hideOnDeselect}return false}},{key:"setClearSearchOnSelect",value:function e(t){if(r.Type.isBoolean(t)){this.clearSearchOnSelect=t}}},{key:"shouldClearSearchOnSelect",value:function e(){return this.clearSearchOnSelect}},{key:"setShowAvatars",value:function e(t){if(r.Type.isBoolean(t)){this.showAvatars=t;if(this.isRendered()){this.getTabs().forEach((function(e){e.renderContainer()}))}}}},{key:"shouldShowAvatars",value:function e(){return this.showAvatars}},{key:"isCompactView",value:function e(){return this.compactView}},{key:"setAutoHide",value:function e(t){if(r.Type.isBoolean(t)){this.autoHide=t;if(this.isRendered()){this.getPopup().setAutoHide(t)}}}},{key:"isAutoHide",value:function e(){return this.autoHide}},{key:"setAutoHideHandler",value:function e(t){if(r.Type.isFunction(t)||t===null){this.autoHideHandler=t}}},{key:"setHideByEsc",value:function e(t){if(r.Type.isBoolean(t)){this.hideByEsc=t;if(this.isRendered()){this.getPopup().setClosingByEsc(t)}}}},{key:"shouldHideByEsc",value:function e(){return this.hideByEsc}},{key:"getWidth",value:function e(){return this.width}},{key:"setWidth",value:function e(t){if(r.Type.isNumber(t)&&t>0){this.width=t;if(this.isRendered()){r.Dom.style(this.getContainer(),"width","".concat(t,"px"))}}}},{key:"getHeight",value:function e(){return this.height}},{key:"setHeight",value:function e(t){if(r.Type.isNumber(t)&&t>0){this.height=t;if(this.isRendered()){r.Dom.style(this.getContainer(),"height","".concat(t,"px"));return p.handleTransitionEnd(this.getContainer(),"height")}else{return Promise.resolve()}}else{return Promise.resolve()}}},{key:"getOffsetLeft",value:function e(){return this.offsetLeft}},{key:"setOffsetLeft",value:function e(t){if(r.Type.isNumber(t)&&t>=0){this.offsetLeft=t;if(this.isRendered()){this.getPopup().setOffset({offsetLeft:t});this.adjustPosition()}}}},{key:"getOffsetTop",value:function e(){return this.offsetTop}},{key:"setOffsetTop",value:function e(t){if(r.Type.isNumber(t)&&t>=0){this.offsetTop=t;if(this.isRendered()){this.getPopup().setOffset({offsetTop:t});this.adjustPosition()}}}},{key:"getZindex",value:function e(){return this.getPopup().getZindex()}},{key:"isCacheable",value:function e(){return this.cacheable}},{key:"setCacheable",value:function e(t){if(r.Type.isBoolean(t)){this.cacheable=t;if(this.isRendered()){this.getPopup().setCacheable(t)}}}},{key:"shouldFocusOnFirst",value:function e(){return this.focusOnFirst}},{key:"setFocusOnFirst",value:function e(t){if(r.Type.isBoolean(t)){this.focusOnFirst=t}}},{key:"focusOnFirstNode",value:function e(){if(this.getActiveTab()){var t=this.getActiveTab().getRootNode().getFirstChild();if(t){t.focus();return t}}return null}},{key:"getFocusedNode",value:function e(){return this.focusedNode}},{key:"clearNodeFocus",value:function e(){if(this.focusedNode){this.focusedNode.unfocus();this.focusedNode=null}}},{key:"isDropdownMode",value:function e(){return this.dropdownMode}},{key:"setPreselectedItems",value:function e(t){this.preselectedItems=this.validateItemIds(t)}},{key:"getPreselectedItems",value:function e(){return this.preselectedItems}},{key:"setUndeselectedItems",value:function e(t){this.undeselectedItems=this.validateItemIds(t)}},{key:"getUndeselectedItems",value:function e(){return this.undeselectedItems}},{key:"setOptions",value:function e(t){var i=this;var n=r.Type.isPlainObject(t)?t:{};if(r.Type.isArray(n.tabs)){n.tabs.forEach((function(e){i.addTab(e)}))}if(r.Type.isArray(n.selectedItems)){n.selectedItems.forEach((function(e){var t=Object.assign({},r.Type.isPlainObject(e)?e:{});t.selected=true;i.addItem(t)}))}if(r.Type.isArray(n.items)){n.items.forEach((function(e){i.addItem(e)}))}this.setHeader(n.header,n.headerOptions);this.setFooter(n.footer,n.footerOptions)}},{key:"getMaxLabelWidth",value:function e(){return this.maxLabelWidth}},{key:"getMinLabelWidth",value:function e(){return this.minLabelWidth}},{key:"getTagSelector",value:function e(){return this.tagSelector}},{key:"getTagSelectorMode",value:function e(){return this.tagSelectorMode}},{key:"isTagSelectorInside",value:function e(){return this.getTagSelector()&&this.getTagSelectorMode()===Qt.INSIDE}},{key:"isTagSelectorOutside",value:function e(){return this.getTagSelector()&&this.getTagSelectorMode()===Qt.OUTSIDE}},{key:"getTagSelectorQuery",value:function e(){return this.getTagSelector()?this.getTagSelector().getTextBoxValue():""}},{key:"setTagSelector",value:function e(t){this.tagSelector=t;this.tagSelector.subscribe("onInput",r.Runtime.debounce(this.handleTagSelectorInput,200,this));this.tagSelector.subscribe("onAddButtonClick",this.handleTagSelectorAddButtonClick.bind(this));this.tagSelector.subscribe("onTagRemove",this.handleTagSelectorTagRemove.bind(this));this.tagSelector.subscribe("onAfterTagRemove",this.handleTagSelectorAfterTagRemove.bind(this));this.tagSelector.subscribe("onAfterTagAdd",this.handleTagSelectorAfterTagAdd.bind(this));this.tagSelector.subscribe("onContainerClick",this.handleTagSelectorClick.bind(this));this.tagSelector.setDialog(this)}},{key:"focusSearch",value:function e(){if(this.getTagSelector()){if(this.getActiveTab()!==this.getSearchTab()){this.getTagSelector().clearTextBox()}this.getTagSelector().focusTextBox()}}},{key:"clearSearch",value:function e(){if(this.getTagSelector()){this.getTagSelector().clearTextBox();if(this.getActiveTab()===this.getSearchTab()){this.selectFirstTab()}}}},{key:"getLoader",value:function e(){if(this.loader===null){this.loader=new a.Loader({target:this.getTabsContainer(),size:100})}return this.loader}},{key:"showLoader",value:function e(){void this.getLoader().show()}},{key:"hideLoader",value:function e(){if(this.loader!==null){void this.getLoader().hide()}}},{key:"destroyLoader",value:function e(){if(this.loader!==null){this.getLoader().destroy()}this.loader=null}},{key:"getPopup",value:function e(){var i=this;if(this.popup!==null){return this.popup}this.getTabs().forEach((function(e){i.insertTab(e)}));this.popup=new t.Popup(Object.assign({contentPadding:0,padding:0,offsetTop:this.getOffsetTop(),offsetLeft:this.getOffsetLeft(),animation:{showClassName:"ui-selector-popup-animation-show",closeClassName:"ui-selector-popup-animation-close",closeAnimationType:"animation"},bindElement:this.getTargetNode(),bindOptions:{forceBindPosition:true},autoHide:this.isAutoHide(),autoHideHandler:this.handleAutoHide.bind(this),closeByEsc:this.shouldHideByEsc(),cacheable:this.isCacheable(),events:{onFirstShow:this.handlePopupFirstShow.bind(this),onAfterShow:this.handlePopupAfterShow.bind(this),onAfterClose:this.handlePopupAfterClose.bind(this),onDestroy:this.handlePopupDestroy.bind(this)},content:this.getContainer()},this.popupOptions));this.rendered=true;this.selectFirstTab();return this.popup}},{key:"isRendered",value:function e(){return this.rendered}},{key:"getContainer",value:function e(){var t=this;return this.cache.remember("container",(function(){var e="";if(t.getTagSelectorMode()===Qt.INSIDE){e=r.Tag.render(Mt||(Mt=babelHelpers.taggedTemplateLiteral(['<div class="ui-selector-search"></div>'])));t.getTagSelector().renderTo(e)}var i=t.isCompactView()?" ui-selector-dialog--compact-view":"";return r.Tag.render(jt||(jt=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div \n\t\t\t\t\tclass="ui-selector-dialog','" \n\t\t\t\t\tstyle="width:',"px; height:",'px;"\n\t\t\t\t>\n\t\t\t\t\t',"\n\t\t\t\t\t","\n\t\t\t\t\t","\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t"])),i,t.getWidth(),t.getHeight(),t.getHeaderContainer(),e,t.getTabsContainer(),t.getFooterContainer())}))}},{key:"getTabsContainer",value:function e(){var t=this;return this.cache.remember("tabs-container",(function(){return r.Tag.render(zt||(zt=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-selector-tabs">\n\t\t\t\t\t',"\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t"])),t.getTabContentsContainer(),t.getLabelsContainer())}))}},{key:"getTabContentsContainer",value:function e(){return this.cache.remember("tab-contents",(function(){return r.Tag.render(Wt||(Wt=babelHelpers.taggedTemplateLiteral(['<div class="ui-selector-tab-contents"></div>'])))}))}},{key:"getLabelsContainer",value:function e(){var t=this;return this.cache.remember("labels-container",(function(){return r.Tag.render(Ut||(Ut=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div \n\t\t\t\t\tclass="ui-selector-tab-labels"\n\t\t\t\t\tonmouseenter="','"\n\t\t\t\t\tonmouseleave="','"\n\t\t\t\t></div>\n\t\t\t'])),t.handleLabelsMouseEnter.bind(t),t.handleLabelsMouseLeave.bind(t))}))}},{key:"getHeaderContainer",value:function e(){var t=this;return this.cache.remember("header",(function(){var e=t.getHeader()&&t.getHeader().getContainer();return r.Tag.render(_t||(_t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-selector-header-container">',"</div>\n\t\t\t"])),e?e:"")}))}},{key:"getFooterContainer",value:function e(){var t=this;return this.cache.remember("footer",(function(){var e=t.getFooter()&&t.getFooter().getContainer();return r.Tag.render(Vt||(Vt=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-selector-footer-container">',"</div>\n\t\t\t"])),e?e:"")}))}},{key:"freeze",value:function e(){if(this.isFrozen()){return}this.frozenProps={autoHide:this.isAutoHide(),hideByEsc:this.shouldHideByEsc()};this.setAutoHide(false);this.setHideByEsc(false);this.getNavigation().disable();r.Dom.addClass(this.getContainer(),"ui-selector-dialog--freeze");this.frozen=true}},{key:"unfreeze",value:function e(){if(!this.isFrozen()){return}this.setAutoHide(this.frozenProps.autoHide!==false);this.setHideByEsc(this.frozenProps.hideByEsc!==false);this.getNavigation().enable();r.Dom.removeClass(this.getContainer(),"ui-selector-dialog--freeze");this.frozen=false}},{key:"isFrozen",value:function e(){return this.frozen}},{key:"hasRecentItems",value:function e(){var t=this;return new Promise((function(e,i){r.ajax.runAction("ui.entityselector.load",{json:{dialog:t.getAjaxJson()},getParameters:{context:t.getContext()}}).then((function(t){e(t.data&&t.data.dialog&&r.Type.isArrayFilled(t.data.dialog.recentItems))}))["catch"]((function(e){i(e)}))}))}},{key:"load",value:function e(){var t=this;if(this.loadState!==qt.UNSENT||!this.hasDynamicLoad()){return}if(this.getTagSelector()){this.getTagSelector().lock()}setTimeout((function(){if(t.isLoading()){t.showLoader()}}),400);this.loadState=qt.LOADING;r.ajax.runAction("ui.entityselector.load",{json:{dialog:this.getAjaxJson()},getParameters:{context:this.getContext()}}).then((function(e){if(e&&e.data&&r.Type.isPlainObject(e.data.dialog)){t.loadState=qt.DONE;var i=r.Type.isArrayFilled(e.data.dialog.entities)?e.data.dialog.entities:[];i.forEach((function(e){var i=t.getEntity(e.id);if(i){i.setDynamicSearch(e.dynamicSearch)}}));t.setOptions(e.data.dialog);t.getPreselectedItems().forEach((function(e){var i=t.getItem(e);if(i){i.select(true)}}));var n=e.data.dialog.recentItems;if(r.Type.isArray(n)){var a=new Map;var s=e.data.dialog.items;if(r.Type.isArray(s)){s.forEach((function(e){if(e.nodeOptions){var i=t.getItem(e);if(i){a.set(i,e.nodeOptions)}}}))}var l=n.map((function(e){var i=t.getItem(e);return[i,a.get(i)]}));t.getRecentTab().getRootNode().addItems(l)}if(!t.getRecentTab().getRootNode().hasChildren()&&t.getRecentTab().getStub()){t.getRecentTab().getStub().show()}if(t.getTagSelector()){t.getTagSelector().unlock()}if(t.isRendered()){if(t.isDropdownMode()&&t.getActiveTab()===t.getRecentTab()){t.selectFirstTab()}else if(!t.getActiveTab()){t.selectFirstTab()}}t.focusSearch();t.destroyLoader();if(t.shouldFocusOnFirst()){t.focusOnFirstNode()}t.emit("onLoad")}}))["catch"]((function(e){t.loadState=qt.UNSENT;if(t.getTagSelector()){t.getTagSelector().unlock()}t.focusSearch();t.destroyLoader();t.emit("onLoadError",{error:e});console.error(e)}))}},{key:"isLoaded",value:function e(){return this.loadState===qt.DONE}},{key:"isLoading",value:function e(){return this.loadState===qt.LOADING}},{key:"hasDynamicLoad",value:function e(){var e=false;this.entities.forEach((function(t){e=e||t.hasDynamicLoad()}));return e}},{key:"hasDynamicSearch",value:function e(){var e=false;this.entities.forEach((function(t){e=e||t.isSearchable()&&t.hasDynamicSearch()}));return e}},{key:"saveRecentItem",value:function e(t){if(this.getContext()===null||!t.isSaveable()){return}this.recentItemsToSave.push(t);this.saveRecentItemsWithDebounce()}},{key:"saveRecentItems",value:function e(){if(!r.Type.isArrayFilled(this.recentItemsToSave)){return}r.ajax.runAction("ui.entityselector.saveRecentItems",{json:{dialog:this.getAjaxJson(),recentItems:this.recentItemsToSave.map((function(e){return e.getAjaxJson()}))},getParameters:{context:this.getContext()}}).then((function(e){}))["catch"]((function(e){console.error(e)}));this.recentItemsToSave=[]}},{key:"shouldClearUnavailableItems",value:function e(){return this.clearUnavailableItems}},{key:"handleTagSelectorInput",value:function e(){if(this.getTagSelectorMode()===Qt.OUTSIDE&&!this.isOpen()){this.show()}var t=this.getTagSelector().getTextBoxValue();this.search(t)}},{key:"handleTagSelectorAddButtonClick",value:function e(){this.show()}},{key:"handleTagSelectorTagRemove",value:function e(t){var i=t.getData(),n=i.tag;var r=this.getItem({id:n.getId(),entityId:n.getEntityId()});if(r){r.deselect()}this.focusSearch()}},{key:"handleTagSelectorAfterTagRemove",value:function e(){this.adjustByTagSelector()}},{key:"handleTagSelectorAfterTagAdd",value:function e(){this.adjustByTagSelector()}},{key:"adjustByTagSelector",value:function e(){var t=this;if(this.getTagSelectorMode()===Qt.OUTSIDE){this.adjustPosition()}else if(this.getTagSelectorMode()===Qt.INSIDE){var i=this.getTagSelector().calcHeight();if(i>0){var n=i-(this.tagSelectorHeight||this.getTagSelector().getMinHeight());this.tagSelectorHeight=i;if(n!==0){var r=this.getHeight();this.setHeight(r+n).then((function(){t.adjustPosition()}))}}}}},{key:"handleTagSelectorClick",value:function e(){this.focusSearch()}},{key:"handleItemSelect",value:function e(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;if(!this.isMultiple()){this.deselectAll();if(this.getSelectedItems().length>0){console.error("EntitySelector: some items are still selected.",this.getSelectedItems())}}if(this.getTagSelector()&&(this.isMultiple()||this.isTagSelectorOutside())){var n=t.createTag();n.animate=i;this.getTagSelector().addTag(n)}this.selectedItems.add(t)}},{key:"handleItemDeselect",value:function e(t){this.selectedItems["delete"](t);if(this.getTagSelector()){this.getTagSelector().removeTag({id:t.getId(),entityId:t.getEntityId()})}}},{key:"handlePopupAfterShow",value:function e(){this.focusSearch();this.adjustByTagSelector();this.emit("onShow")}},{key:"handlePopupFirstShow",value:function e(){var t=this;this.emit("onFirstShow");requestAnimationFrame((function(){requestAnimationFrame((function(){r.Dom.addClass(t.getPopup().getPopupContainer(),"ui-selector-popup-container")}))}));this.observeTabOverlapping()}},{key:"handleAutoHide",value:function e(t){var i=t.target;var n=this.getPopup().getPopupContainer();if(i===n||n.contains(i)){return false}if(this.isTagSelectorOutside()&&i===this.getTagSelector().getTextBox()&&r.Type.isStringFilled(this.getTagSelector().getTextBoxValue())){return false}if(this.autoHideHandler!==null){var a=this.autoHideHandler(t,this);if(r.Type.isBoolean(a)){return a}}return true}},{key:"observeTabOverlapping",value:function e(){var t=this;this.disconnectTabOverlapping();this.overlappingObserver=new MutationObserver((function(){if(t.getLabelsContainer().offsetWidth>0){var e=parseInt(t.getPopup().getPopupContainer().style.left,10);if(e<t.getMinLabelWidth()){r.Dom.style(t.getPopup().getPopupContainer(),"left","".concat(t.getMinLabelWidth(),"px"))}}}));this.overlappingObserver.observe(this.getPopup().getPopupContainer(),{attributes:true,attributeFilter:["style"]})}},{key:"disconnectTabOverlapping",value:function e(){if(this.overlappingObserver){this.overlappingObserver.disconnect()}}},{key:"handlePopupAfterClose",value:function e(){if(this.isTagSelectorOutside()){if(this.getActiveTab()&&this.getActiveTab()===this.getSearchTab()){this.selectFirstTab()}this.getTagSelector().clearTextBox();this.getTagSelector().showAddButton();this.getTagSelector().hideTextBox()}this.emit("onHide")}},{key:"handlePopupDestroy",value:function e(){this.destroy()}},{key:"handleLabelsMouseEnter",value:function e(){var t=this;var i=r.Dom.getRelativePosition(this.getLabelsContainer(),this.getPopup().getTargetContainer());var n=i.right;if(n>this.getMinLabelWidth()){r.Dom.removeClass(this.getLabelsContainer(),"ui-selector-tab-labels--animate-hide");r.Dom.addClass(this.getLabelsContainer(),"ui-selector-tab-labels--animate-show");r.Dom.style(this.getLabelsContainer(),"max-width","".concat(Math.min(n,this.getMaxLabelWidth()),"px"));p.handleTransitionEnd(this.getLabelsContainer(),"max-width").then((function(){r.Dom.removeClass(t.getLabelsContainer(),"ui-selector-tab-labels--animate-show");r.Dom.addClass(t.getLabelsContainer(),"ui-selector-tab-labels--active")}))}else{r.Dom.addClass(this.getLabelsContainer(),"ui-selector-tab-labels--active")}}},{key:"handleLabelsMouseLeave",value:function e(){var t=this;r.Dom.addClass(this.getLabelsContainer(),"ui-selector-tab-labels--animate-hide");r.Dom.removeClass(this.getLabelsContainer(),"ui-selector-tab-labels--animate-show");r.Dom.removeClass(this.getLabelsContainer(),"ui-selector-tab-labels--active");p.handleTransitionEnd(this.getLabelsContainer(),"max-width").then((function(){r.Dom.removeClass(t.getLabelsContainer(),"ui-selector-tab-labels--animate-hide")}));r.Dom.style(this.getLabelsContainer(),"max-width",null)}},{key:"handleItemNodeFocus",value:function e(t){var i=t.getData(),n=i.node;if(this.focusedNode===n){return}this.clearNodeFocus();this.focusedNode=n}},{key:"handleItemNodeUnfocus",value:function e(){this.clearNodeFocus()}},{key:"getAjaxJson",value:function e(){return{id:this.getId(),context:this.getContext(),entities:this.getEntities(),preselectedItems:this.getPreselectedItems(),clearUnavailableItems:this.shouldClearUnavailableItems()}}}],[{key:"createHeader",value:function e(t,i,n){if(!r.Type.isStringFilled(i)&&!r.Type.isArrayFilled(i)&&!r.Type.isDomNode(i)&&!r.Type.isFunction(i)){return null}var a=null;var s=r.Type.isPlainObject(n)?n:{};if(r.Type.isFunction(i)||r.Type.isString(i)){var l=r.Type.isString(i)?r.Reflection.getClass(i):i;if(r.Type.isFunction(l)){a=new l(t,s);if(!(a instanceof qe)){console.error("EntitySelector: header is not an instance of BaseHeader.");a=null}}}if(i!==null&&!a){a=new vt(t,Object.assign({},s,{content:i}))}return a}},{key:"createFooter",value:function e(t,i,n){if(!r.Type.isStringFilled(i)&&!r.Type.isArrayFilled(i)&&!r.Type.isDomNode(i)&&!r.Type.isFunction(i)){return null}var a=null;var s=r.Type.isPlainObject(n)?n:{};if(r.Type.isFunction(i)||r.Type.isString(i)){var l=r.Type.isString(i)?r.Reflection.getClass(i):i;if(r.Type.isFunction(l)){a=new l(t,s);if(!(a instanceof Xe)){console.error("EntitySelector: footer is not an instance of BaseFooter.");a=null}}}if(i!==null&&!a){a=new mt(t,Object.assign({},s,{content:i}))}return a}}]);return i}(n.EventEmitter);var Jt={Dialog:Gt,Item:Ne,Tab:Ye,Entity:Pe,TagSelector:ft,BaseHeader:qe,DefaultHeader:vt,BaseFooter:Xe,DefaultFooter:mt,BaseStub:Me,DefaultStub:_e};e.EntitySelector=Jt;e.Dialog=Gt;e.Item=Ne;e.Tab=Ye;e.Entity=Pe;e.TagSelector=ft;e.BaseHeader=qe;e.DefaultHeader=vt;e.BaseFooter=Xe;e.DefaultFooter=mt;e.BaseStub=Me;e.DefaultStub=_e})(this.BX.UI.EntitySelector=this.BX.UI.EntitySelector||{},BX.Main,BX.Collections,BX.Event,BX,BX);
//# sourceMappingURL=entity-selector.bundle.map.js